EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: sguisse on June 30, 2016, 02:27:50 AM



Title: treeGrid - Add Columns whithout reload all the grid
Post by: sguisse on June 30, 2016, 02:27:50 AM
Hello,

I would like to know if it exists a mechanism to addColums and data to a treegrid whithout reload the entire GRID
I don't need the fonctionnatity describe here http://www.jeasyui.com/tutorial/datagrid/datagrid6.php  because it reload the entire Grid

Insteed, I need 2 methods to concat Columns and data with an already created table, for exemple :
- treegrid.concatHeaderColumns (builded new column from JSON);
- treegrid.concatBodyDatacolumns (Json data to add);

The goal is to load a first part of the grid to display it quicky to the user
And in background I will load and construct the other table parts (by column) in a thread worker to fill all needed data.

Thanks in advance for your help.
Sébastien.


Title: Re: treeGrid - Add Columns whithout reload all the grid
Post by: stworthy on July 01, 2016, 12:04:46 AM
To modify the columns, you have to re-create the treegrid with new 'columns'. To prevent from retrieving data from remote server again, please try this:
Code:
var tg = $('#tg');
var opts = tg.treegrid('options');
var data = tg.treegrid('getData');
var url = opts.url;
opts.url = null;
tg.treegrid({
        columns:[[
                {field:'name',title:'Name',width:300}
        ]]
});
tg.treegrid('loadData',data);
opts.url = url;


Title: Re: treeGrid - Add Columns whithout reload all the grid
Post by: sguisse on July 01, 2016, 12:56:22 AM
I can't use this proposal because of performance problem I can have more than 366 colums to build If user wants to see his planning on 1 year.
That's why, I Would like to build columns by lazy loading like for rows.

Or Can I use this hack ?
Build the next columns of the table in an other hidden table and then merge this hidden table with the first one ?
But how to do this merge?

Thanks


Title: Re: treeGrid - Add Columns whithout reload all the grid
Post by: stworthy on July 03, 2016, 06:36:17 PM
Please look at this example http://code.reloado.com/iriqoy3/edit#preview. The treegrid has more than 300 columns. It has good performance.


Title: Re: treeGrid - Add Columns whithout reload all the grid
Post by: sguisse on July 04, 2016, 02:30:41 AM
Hello,

Effectively I have done a test with my use case and with data provided for 1 year on 7 rows and the table was created in less than 4 seconds from http://code.reloado.com

My Use case :
http://code.reloado.com/emepep3/edit#javascript,html

On my desk this use case takes more than 20 seconds to be displayed. Strange ??
To be more precise I have 4 locked columns, header group with 4 rows, dnd is activated on treegrid.

If possible, I wish I still have a way to dynamically add columns if we find production performance problems
Thank you very much

Sébastien