HiveBrain v1.2.0
Get Started
← Back to all entries
patternjavascriptMinor

Kendo grid optimization

Submitted by: @import:stackexchange-codereview··
0
Viewed 0 times
optimizationkendogrid

Problem

I have two kendoGrid(s) named:

var sourcegrid = $('#usersGrid').data("kendoGrid");        //SOURCE GRID
var destinationgrid = $('#teamGrid').data('kendoGrid');    //DESTINATION GRID


In sourcegrid, I have 1000 records and in destinationgrid has no records.

I have a button that transfers data from sourcegrid to destinationgrid.

sourcegrid.select().each(function () {
        var dataItem = sourcegrid.dataItem($(this));
        destinationgrid.dataSource.add(dataItem);
        sourcegrid.removeRow($(this));
    });


When I'm transferring 500 records to destinationgrid, the process of transferring is so slow. How can this be optimized?

You can use this jsfiddle.net link here.

Solution

Capitalisation:

If you're gonna use variables like this: kendoGrid, dataItem, but then have variables like: destinationgrid and sourcegrid, then stick with one (preferably the first, because it's easier to read)
Optimizing:

It seemed for me, that removing this line increased the speed:

editable: "popup",

Because with your code it popups for each data cell being removed, which is fine, if that's what you want

However, it seems with your code that it doesn't support the movement of more than one data cell at a time.
Note:

If you're wanting the user to select more than one nearly every time, then using popups is fine, but make it one popup per action.

Context

StackExchange Code Review Q#76881, answer score: 2

Revisions (0)

No revisions yet.