要禁止单元格调整宽度,您可以使用以下代码:

require(["gridx/Grid", "gridx/core/model/cache/Sync", "gridx/modules/CellResizer"], function(Grid, Cache, CellResizer){
  var grid = new Grid({
    cacheClass: Cache,
    modules: [
      CellResizer
    ],
    structure: [
      {id: 'col1', field: 'col1', name: 'Column 1', resizable: false},
      {id: 'col2', field: 'col2', name: 'Column 2', resizable: true},
      {id: 'col3', field: 'col3', name: 'Column 3', resizable: true}
    ],
    store: ...
  });
  grid.placeAt('gridContainer');
  grid.startup();
});

在这里,我们在结构中设置了 resizable 属性为 false,这将禁止列调整大小。请注意,如果您使用了 CellResizer 模块,则必须将其添加到模块列表中。

此外,如果您希望禁止所有列调整大小,则可以将 resizable 属性设置为 false

structure: [
  {id: 'col1', field: 'col1', name: 'Column 1', resizable: false},
  {id: 'col2', field: 'col2', name: 'Column 2', resizable: false},
  {id: 'col3', field: 'col3', name: 'Column 3', resizable: false}
],
``
dojo grid gridxCell 列禁止调整宽度

原文地址: https://www.cveoy.top/t/topic/fsg8 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录