Hi,
I have already created a new kendo.data.dataSource with success, and I am able to bind it to the KendoUI Grid on my page.
But when I try to dataSource.insert(0, [a : "b"]); it removes the data that was there previously.
My example code follows:
This is how I'm binding to the grid:
This is how I add a new item:
If I perform the add before binding the data to the Grid, I lose the first two items that were originally on the dataSource object.
In summary:
I have a pre-created dataSource binded to a Grid. I want to be able to add a new item to the dataSource, and then refresh the Grid so that the new item appears.
Thanks,
LCG
I have already created a new kendo.data.dataSource with success, and I am able to bind it to the KendoUI Grid on my page.
But when I try to dataSource.insert(0, [a : "b"]); it removes the data that was there previously.
My example code follows:
var
tempSource =
new
kendo.data.DataSource({
data: [{
"ID"
:1,
"Name"
:
"Cliente 1"
,
"NameID"
:
"1 - Cliente 1"
},{
"ID"
:2,
"Name"
:
"Cliente 2"
,
"NameID"
:
"2 - Cliente 2"
}]
});
This is how I'm binding to the grid:
$(
"#association-grid"
).kendoGrid(
{
height: 99,
columns:
[
{
field:
"ID"
,
title:
"ID"
},
{
field:
"Name"
,
title:
"Name"
},
{
field:
"NameID"
,
title:
"NameID"
}
],
dataSource: tempSource
});
This is how I add a new item:
tempSource.insert(0, { ID:
"John Smith"
, Name:
"Product Description"
, NameID:
"123 1st Street"
});
If I perform the add before binding the data to the Grid, I lose the first two items that were originally on the dataSource object.
In summary:
I have a pre-created dataSource binded to a Grid. I want to be able to add a new item to the dataSource, and then refresh the Grid so that the new item appears.
Thanks,
LCG