trioz123 / jquery-datatables-editable

Automatically exported from code.google.com/p/jquery-datatables-editable
0 stars 0 forks source link

makeEditable seems to be very slow. #103

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. create a page with a data grid but no data
2. load some rows in the table
3. call table.makeEditable()

What is the expected output? What do you see instead?
I would expect that it returns quickly and the table is editable.

What version of the product are you using? On what operating system?
datatables-editable 1.3 Firefox 10 windows 7 pro x64

Please provide any additional information below.
I originally tried calling makeEditable() on table creating but the rows added 
later were not editable, so I moved the call to make editable to the code that 
loads the table.  That made the cells editable, but the call to makeEditable() 
freezes the browser for about 10 seconds on a table with 30 rows.

The grid variables below point to the dataTables objects.  This piece of code 
use to take about 1/4 seconds to execute, after adding makeEditable calls it 
takes 10-15 seconds and the browser is frozen while it runs.

ACLListGrid.fnClearTable();
if (obj.acls != null)
    ACLListGrid.fnAddData(obj.acls);
ACLListGrid.parent().height(ACLListGrid.fnSettings().oScroller.fnRowToPixels(10)
);
var oTT = TableTools.fnGetInstance( document.getElementById('ACLList') );
oTT.fnResizeButtons(); 
ACLListGrid.fnAdjustColumnSizing();
ACLListGrid.makeEditable();

// fix groups
var groups = new Array();
for(var grp in obj.groups) {
    groups.push(obj.groups[grp]);
}
GroupListGrid.fnClearTable();
GroupListGrid.fnAddData(groups);
GroupListGrid.parent().height(GroupListGrid.fnSettings().oScroller.fnRowToPixels
(10));
var oTT = TableTools.fnGetInstance( document.getElementById('GroupList') );
oTT.fnResizeButtons();
GroupListGrid.fnAdjustColumnSizing() 
GroupListGrid.makeEditable();

Original issue reported on code.google.com by paulrubi...@gmail.com on 20 Mar 2012 at 6:37

GoogleCodeExporter commented 9 years ago
I am sorry, a browser reload seems to have fixed this.  No I need to learn how 
to capture the changes I really just want to update the table and commit all 
changes at once.

Original comment by paulrubi...@gmail.com on 20 Mar 2012 at 6:42

GoogleCodeExporter commented 9 years ago
Actually now it is very slow again, I am not sure what is happening.

Original comment by paulrubi...@gmail.com on 20 Mar 2012 at 6:55

GoogleCodeExporter commented 9 years ago
I changed the code to this:

console.log("ACLListGrid.makeEditable start " + (new Date()));
ACLListGrid.makeEditable(   );
console.log("ACLListGrid.makeEditable done " + (new Date()));

And that got me this:

ACLListGrid.makeEditable start Tue Mar 20 2012 15:39:13 GMT-0400 (Eastern 
Daylight Time)
ACLListGrid.makeEditable done Tue Mar 20 2012 15:39:43 GMT-0400 (Eastern 
Daylight Time)

30 seconds to complete makeEditable() on 2906 rows.  Ok I see what's happening 
now.  I have a number of 'master' rows of data when I select a particular one 
that puts 2906 rows into the editable table that is when it takes 30 seconds.

When I pick an item with 30 or 40 rows it is very fast.  With the call to 
makeEditable() missing it is less than 1 second.

Original comment by paulrubi...@gmail.com on 20 Mar 2012 at 7:45

GoogleCodeExporter commented 9 years ago
By default this plugin is applying editable to every cell in the table at once 
when it first loads.  I changed the code to apply editable on the cell as it's 
clicked or focused only rather than all at once and it sped things up a lot.

Original comment by z...@optiexp.com on 27 Mar 2013 at 5:08

GoogleCodeExporter commented 9 years ago
Can you submit your change?

Original comment by dev...@gmail.com on 29 Mar 2013 at 6:24

GoogleCodeExporter commented 9 years ago
I would be interested in this change as well. Even if you could post your 
change here. 

Original comment by jeff.sex...@gmail.com on 1 May 2013 at 6:21

GoogleCodeExporter commented 9 years ago
Yes Please share your code @optiexp.com

Original comment by mlow7...@gmail.com on 20 May 2013 at 1:37