I'm moving data between two different Kendo grids, removing items from one and adding them to another. I'm not going by the 'delete' command for removing them. I've noticed a bug where one of the grids has dataItems reappear in the view after triggering a filter, page, sort etc. action. This gird is created with locally bound data, via the data property of the datasource, so it has a copy of the 'pristine' data floating. I had to resort to the following to get them to be permanently removed.
If I don't whack the removed entries from the dataSource.options.data copy, they reappear.
I haven't gotten to the point where I'm adding items back the other way, but I'm half anticipating a similar problem. Is there a solution for this? Some method to save or sync the data source?
Here's the rest of the grid declaration - I realize I could probably turn it back into a properly wrapped MVC helper extension, but I've grown to like the greater control provided by the straight JS initialization.
var rows = chooseGrid.select(), dataItems = [];for (var i = rows.length; i--;) { dataItems.unshift(chooseGrid.dataItem(rows[i])); chooseGrid.dataSource.remove(dataItems[0]); koqGrid.dataSource.insert(AdminToProfileKoQ(dataItems[0])); addedQuestions.unshift(dataItems[0]); for(var j = chooseGrid.dataSource.options.data.length; j--; ) { if(chooseGrid.dataSource.options.data[j].Id == dataItems[0].Id) { chooseGrid.dataSource.options.data.splice(j, 1); break; } }};I haven't gotten to the point where I'm adding items back the other way, but I'm half anticipating a similar problem. Is there a solution for this? Some method to save or sync the data source?
Here's the rest of the grid declaration - I realize I could probably turn it back into a properly wrapped MVC helper extension, but I've grown to like the greater control provided by the straight JS initialization.
$("#ChooseKnockOutQuestionGrid").kendoGrid({ dataSource: { schema : { model: { fields: { Id: { type: "number" }, AdminLeadType: { type: "number" }, Answer1Text: { type: "string" }, Answer2Text: { type: "string" }, Enabled: { type: "boolean" }, QuestionText: { type: "string" }, QuestionTypeId : {type: "number"}, Price: { type: "number" } } } }, data : @Html.Raw(ViewBag.Data), pageSize: 5, serverFiltering: false, serverGrouping: false, serverSorting: false, serverPaging: false }, filterable: true, sortable: true, selectable: "multiple, row", columns: [{ field:"QuestionText", title:"Question Text" }, "Price"], dataBound: OnChooseDataBound, change: OnChooseChange});