Hello,
I have an autocomplete field which on selection adds a new row to my grid. The row appears on the grid, but when I click a button which has the sync() method, the grid does not send any data. I explored the datasource, and it has all its new records set to dirty=false as if the grid has been synced before.
Here is how I add new row(s) to the grid:
I have also tried using the method add, but I got the same results.
Here is the grid declaration:
I also tried to set the flag dirty manually but this causes some other problems, the datasource is disconnected from the grid.
This returns an error:
I have an autocomplete field which on selection adds a new row to my grid. The row appears on the grid, but when I click a button which has the sync() method, the grid does not send any data. I explored the datasource, and it has all its new records set to dirty=false as if the grid has been synced before.
Here is how I add new row(s) to the grid:
var ds = $("#selected_locations").data("kendoGrid").dataSource;var mod = ds.insert(0, { id: dataItem.id, Location: dataItem.Name, Reach: 10000});Here is the grid declaration:
$("#selected_locations").kendoGrid({ dataSource: { schema: { model: { id: "id", fields: { Location: { type: "string", editable: false }, Reach: { type: "number", editable: false } } } }, type: "json", transport: { read: { url:"createCampaignData.php", dataType: "json", type: "GET", contentType: "application/json; charset=utf-8", data: { funct: "getGeoLocGrid", model: "geoLocation", form: <?php if(isset($id)) echo $id; else echo '0'; ?> } }, destroy: { type: "POST", data: { operation: "delete" } }, create: { type: "POST", data: {operation: "create"}, cache: false } }, autoSync: false, batch: true }, columns: [ { field:"Location" }, { field: "Reach", format: "{0:n0}" }, { title: "Action", command: "destroy" }], editable: true, scrollable: true, sortable: false, filterable: false, pageable: false });I also tried to set the flag dirty manually but this causes some other problems, the datasource is disconnected from the grid.
var newData = ds.data();newData[0].dirty = true;ds.data(newData);This returns an error: