Skip to content

Refresh Grid Column Width Fix on Small Screens

Jason Lewis edited this page Feb 25, 2021 · 1 revision

With Syncfusion grids if you use minWidth and width on your columns to make sure they don't disappear on small screens (enables scrollbar), refreshing the page won't respect the widths until you drag the window bigger or smaller, and then it will update correctly. The fix is to add a dataBound handler to the grid with the following contents:

dataBound: function () { 
    var tgridWidth = this.$refs.grid.ej2Instances.widthService.getTableWidth(this.$refs.grid.getColumns()); 
    this.$refs.grid.ej2Instances.widthService.setMinwidthBycalculation(tgridWidth); 
} 
Clone this wiki locally