EasyUI Forum
May 27, 2024, 03:43:05 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: treeGrid - Add Columns whithout reload all the grid  (Read 5616 times)
sguisse
Newbie
*
Posts: 8


View Profile
« 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.
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 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;
Logged
sguisse
Newbie
*
Posts: 8


View Profile
« Reply #2 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
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #3 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.
Logged
sguisse
Newbie
*
Posts: 8


View Profile
« Reply #4 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
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!