This is a migrated thread and some comments may be shown as answers.

problem calling get on grid's dataSource

1 Answer 177 Views
Grid
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 10 Mar 2012, 12:49 AM
I'm trying to do a remove on my grid's dataSource, so the first thing I try to do is to get the model I want to remove:

var toRemove = grid.data("kendoGrid").dataSource.get(deleteId);

This is causing an error:

"Uncaught TypeError: Cannot call method 'get' of undefined" (references kendo.all.js:4735)

What's puzzling about this is that grid.data("kendoGrid").dataSource isn't undefined and I can successfully call filter on it. Am I missing something here when using .get()?


1 Answer, 1 is accepted

Sort by
0
James
Top achievements
Rank 1
answered on 10 Mar 2012, 01:31 AM
Figured it out. I had to define a model first, set the id of the model appropriately, then set the schema property of my dataSource to the model object I created (thank you, Kendo UI dataSource video). It would probably help clarify the documentation to include this step for removing something from a dataSource as this get then remove pattern is going to generate the error I described without it.
Tags
Grid
Asked by
James
Top achievements
Rank 1
Answers by
James
Top achievements
Rank 1
Share this question
or