How can i update the hidden cell value efficiently?
How can i update the hidden cell value efficiently?
toroNGT
Posts: 7Questions: 2Answers: 0
Hello
I have datatable with hidden column. I am updating the hidden cell values one by one with following code: table.cell( { row: rowIdx, column: columnIdx } ).data(someValue);
I have nearly 3000 rows in my table and the update takes noticeable time. Is there more fast, efficient and correct way to change values of hidden cells? Or is there a way to add hidden data to a row, that will not be visible to user but accessible from javascript?
Thank you
This discussion has been closed.
Replies
Hi @toroNGT ,
Is there a reason why you're updating all 3000 rows at once? Is it because you're summing a total on all the values? If not, and you're using paging, you could use one of the callback functions,
draw
ordrawCallback
, to only update the visible rows as they're displayed - this would significantly speed up that process.Cheers,
Colin
hi @colin
What i am trying to do is following: i am selecting rows in datatable. When certain rows are selected, i set hidden cell values to either selected = (
true
) or not selected = (false
). After this i have added custom button to datatable and when clicking on that button, i want to display only selected rows, usingsearch()
function on that hidden column. Is there a better way to accomplish this?(I have also added a custom button to select all the rows. Selection itself works fast, but setting hidden cells with value takes noticeable time)
Thank you
Hi @toroNGT ,
Yeah, that's a hard way of doing that. The best way would be to use the Select plugin, take a look at this example here - it allows you to Select multiple rows, and the button click uses the API to return those selected (which is what you want, I believe),
Cheers,
Colin
Hi @colin
Is it possible to use
selector-modifier
insidetable.search()
function? Or could you please point me how to do this? - I want to display only selected rows to the user.Thank you
Hi again,
This thread here on StackOverflow may be a good solution - it's from @gyrocode 's who posts here too. It requires a checkbox to do the selection, but otherwise, it does what you're after. Would this work?
Cheers,
Colin