Gridjs屏幕尺寸变化后,不会自适应

image.jpg (282.7 KB)

前端收缩菜单后,gridjs没有重新计算尺寸,出现了空白区域,能都提供重新绘画的接口

@feng.qun.zhu.avaryholding.com

收缩菜单,具体是指什么,如何操作的?

再举个例子,小窗口浏览器加载后,再最大化后,excel不会跟着铺满,出现空白,是否有接口,可以让他随着窗口大小改变而自适应铺满

@feng.qun.zhu.avaryholding.com
明白了,这个可以复现,已建单
CELLSGRIDJS-1463 When the browser window’s size changes, the UI layout needs to adapt accordingly.

@feng.qun.zhu.avaryholding.com
注意在loadoption 里下面的写法是有问题的

 let pwidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
 let pheight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
            const option = {
                updateMode: 'server',
                updateUrl: '/GridJs2/UpdateCell',
                showToolbar: true,
                view: { width: () => pwidth , height: () => pheight  },
...

写成下面这样就可以了

 
            const option = {
                updateMode: 'server',
                updateUrl: '/GridJs2/UpdateCell',
                showToolbar: true,
                //下面的宽高选项设置,直接不用设置(我们程序里默认就是用的document.body.clientWidth)或者写成
                 view: { 
width: () => window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth, 
height: () => window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight},

关键点在于,浏览器窗口resize的时候,width和height也是同步发生变化,在第一种写法里面,是不会发生变化的。