EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: x3no on September 23, 2013, 11:29:39 PM



Title: Datagrid automatic width
Post by: x3no on September 23, 2013, 11:29:39 PM
Hello,

The issue I am facing is as follows:
Datagrid pager and header take 100% of the page width, while actual data columns take much less
space.
So datagrid-btable is 487px wide which is exactly how wide I want my datagrid to be.
In the meantime datagrid-body and the rest of divs are 1888px wide.

Whats the best way to make the whole datagrid as wide as datagrid-btable?

I considered resize function, but can't seem to find an event (after datagrid widths are set) on which to fire it.


Title: Re: Datagrid automatic width
Post by: x3no on September 25, 2013, 05:51:08 AM
The best solution I managed to come up with is this function:
   function resizeDg() {
        $('#dg').datagrid('resize', { width: $('.datagrid-btable').width()+2 });
    }

For now it is being called after right after data load (had to override the loader and put it right after _698(data)), and works most of the time.
However it still performs the resize incorrectly when there is a delay between the moment when data is loaded and the moment when data rows are displayed with calculated width.

So the questions still stand.
Is there a better way do to this?
Is there an event that fires once rows are displayed with calculated width?