EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: Pierre on September 04, 2018, 12:07:46 PM



Title: [SOLVED] Columns width
Post by: Pierre on September 04, 2018, 12:07:46 PM
Hello
I have datagrid with 5 columns. Datagrid should be used on Desktop and Mobile devices.
What I need is this:
if screensize is bigger then 1000px, columns need to be resized to fill empty area (please see right side on attached image).
If screen is smaller then 1000px, columns should not be resized.
How to do that, please?


Title: Re: Columns width
Post by: jarry on September 04, 2018, 06:45:46 PM
Set 'fitColumns' property to true and then call 'fitColumns' method. The datagrid will fit the grid width. Please try this code:
Code:
var width = $(window).width();
if (width>1000){
var dg = $(target);
var opts = dg.datagrid('options');
opts.fitColumns = true;
dg.datagrid('fitColumns');
}


Title: Re: Columns width
Post by: Pierre on September 04, 2018, 09:42:51 PM
Awesome, thank you so much.