On the destroy event in a grid, I need to have it remove it from the grid and set a delete flag so that when I hit sync it will remove it from the remote database. Right now it saves to localstorage (so they can close the browser and come back to it) then you can sync it up. Problem is that deleting it from the local database means it doesn't send anything to the server to tell it should be deleted. If there is a way to change the "Venue" line to read "deleted" or something then I can parse that out, but I'd want it to not show.
Hopefully that makes some sense.
Here is the delete in the grid call.
Here is the removeLine function:
Here is my datasource:
Hopefully that makes some sense.
Here is the delete in the grid call.
command : [{
name :
"delete"
,
text :
"Del"
,
click: removeLine,
}],
Here is the removeLine function:
1.
function
removeLine(e) {
2.
console.log(
'removeLine'
);
3.
e.preventDefault();
4.
var
dataItem = $(e.currentTarget).closest(
"tr"
);
5.
console.log(dataItem);
6.
}
01.
dataSource =
new
kendo.data.DataSource({
02.
change :
function
() {
03.
var
dataSourceJson = JSON.stringify(dataSource._data);
04.
console.log(dataSourceJson);
05.
// Set Datasources into localstorage
06.
localStorage.setItem(
'dataSource'
, dataSourceJson);
07.
}, data : products, pageSize : 20, schema : {
08.
model : {
09.
id :
"ID"
,
10.
fields : {
11.
ID : {
12.
Type:
"number"
13.
},
14.
Venue : {
15.
type :
"string"
16.
}, Match : {
17.
type :
"number"
18.
}, Team : {
19.
type :
"number"
20.
}, Alliance : {
21.
type :
"string"
,
22.
}, DO : {
23.
type :
"string"
24.
}, CP : {
25.
type :
"number"
26.
}, AP : {
27.
type :
"number"
28.
}, AF : {
29.
type :
"number"
30.
}, TP : {
31.
type :
"number"
32.
}, TF : {
33.
type :
"number"
34.
}
35.
36.
}
37.
38.
}
39.
}
40.
});