Move big data between two datatable very very long

Hello , I have two datatables with multiple selection , If I wan't to move 10000 entries from datatable1 to datatable2 , it is very very long and firefox give an error message several times for stop or not a script.

I use "add" and "remove" methods , is there another solution for optimize this ?

Thanks

Comments

  • edited August 6

    Hey @romain, since you are most likely performing add/delete for every entry you are trying to move, they will all try and render as soon as they are added/deleted. You can mitigate this by passing all your data at once inside your remove/parse operations to only perform render once, thus reducing the operation time.

    You can serialize the data that you have and work with it that way, so that you don't tax the browser by using selection methods, if you need to select a specific range you'll have to use the native array methods and work with that.

    From what I've tested so far this way seems faster than normal: https://snippet.webix.com/ijnrv7am.

    P.S. As an alternative for moving the data between the tables I would suggest looking at the clipboard functionality, where you can copy paste data between tables without much of a performance hit, (althought this method only covers the manual use case): https://snippet.webix.com/dq37s6fp.

  • Thanks for the response , with your snippet , is it possible to move just data selected in datatable to the other datatable and add property before move (for example : {priority : 5} for all rows selected ?

  • edited August 7

    Well, it is possible in theory to move the selected data, but in your case with very large amounts of data it pretty much won't work, since the selection of items takes up a lot of time, and it slows down the overall process dramatically, i.e. here's something close to it to try it out: https://snippet.webix.com/wszb867u (I don't recommend you try and move a lot of data at once, your browser will probably crash).

    Hence why I recommended you the way from the example above, you pretty much can't use selection at all if you want to move loads of data (and obviously you can probably use that for smaller datasets just fine), but you can get the needed range with the help of native array methods, for instance Array.slice(). It is also not that hard to add a property to each row (via map in our case, there are other ways, of course), however, yet again, the performance will take a hit.

    Overall, here is the approximate solution (I'm selecting a range of 1-1000 in this one): https://snippet.webix.com/lp1piqt0.

  • I had exactly the same solution than you (https://snippet.webix.com/wszb867u) that's why I post my problem ;) , I must have 'multiselect' ( no 'areaselect') so you confirm me that with big data , it is not possible to optimize code to have reactive result :( (it is not possible to parse and map with selectedItem ?), thank you very much for response , it is much clearer for me now ;)

  • Sure, you can use map in this example as well - https://snippet.webix.com/xdltgbq6, but you can imagine how much slower that's going to be. As for the areaselect and multiselect there isn't much difference at all, I was merely testing some stuff out, it doesn't affect the perfomance in any way, since the selection logic that gets triggered is the same in both cases.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion