EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: jpierce on June 18, 2013, 04:16:03 PM



Title: set datagrid title without reloading results?
Post by: jpierce on June 18, 2013, 04:16:03 PM
Is there some way to set the datagrid's title that doesn't cause it to reload the results?  When I do this:

mytable.datagrid({title:'foo'})

It always fetches the data from the server again.

As far as I can tell, the only way is to hack around it to change the element's text directly.


Title: Re: set datagrid title without reloading results?
Post by: stworthy on June 18, 2013, 06:12:37 PM
Get the panel object and then you will be able to do anything about panel.
Code:
var p = $('#dg').datagrid('getPanel');  // the panel object
p.panel('setTitle', 'newtitle');  // change the panel title


Title: Re: set datagrid title without reloading results?
Post by: jpierce on June 19, 2013, 06:24:24 AM
Thanks!  Obvious once it's pointed out  :D


Title: Re: set datagrid title without reloading results?
Post by: jpierce on June 19, 2013, 06:29:12 AM
Hmm, actually, bit of a complication.  What if the grid didn't have a title to begin with, and you want to set the title?  When I use your code to set the title after the grid has loaded, it never shows up.  I tried calling

table.datagrid('getPanel').panel('open');

But that didn't do anything obvious.