Hello
We are developing a module whereby what is selected on one grid filters a second grid. As part of this we need to enable multi-select on the master grid.
I have two separate scripts for getting the data item of the selected grids, but both seem a little slow, ~1 sec to ~3 secs.
The scripts we are testing are:
onChange: function(ev) {
var that = this;
var selected = $.map(ev.sender.select(), function(item) {
var tr = $(item).closest('tr');
var grid = that.$refs.itemsGrid.kendoWidget();
var data = grid.dataItem(tr);
return data.itemNumber;
});
this.$root.$emit('item-grid-selected',selected);
},
change: function(e) {
var selectedRows = e.sender.select();
var selectedDataItems = [];
for (var i = 0; i < selectedRows.length; i++) {
var dataItem = e.sender.dataItem(selectedRows[i]);
selectedDataItems.push(dataItem.name);
}
console.log(selectedDataItems);// contains all selected data items
this.$root.$emit('item-grid-selected',selectedDataItems);
},
with the grid code of:
<
kendo-grid
ref
=
"itemsGrid"
:data-source
=
"items"
v-on:databound
=
"autoFitColumns"
:sortable-mode
=
"'single'"
:sortable-allow-unsort
=
"true"
:groupable
=
"true"
:pageable
=
"false"
:page-size
=
"20"
:pageable-page-size
=
"10"
:pageable-always-visible
=
"false"
:filterable-mode
=
"'row'"
:selectable
=
"'multiple'"
:toolbar
=
"[]"
:editable
=
"false"
:server-paging
=
"false"
:column-menu
=
"true"
:scrollable-horizontal
=
"true"
v-on:change
=
"change"
v-on:save
=
"grid_save"
>
</
kendo-grid
>
Without any event raised on the change event of the grid, the selection following a click of any rows in the grid is seemingly instant. Just for info, there are only three rows in this table, so it is not because there is a lot to go through.
Can you make any suggestions for speeding this up?
Regards
John