My question is relative to an update of my grid. Here is my current program of grid generation :
leTle[0] = {index : 1, tle : tleId, nom : nomChamp, estar : "", fige : tleFixe, position : positionParam, longueur : longueurParam};
var fige;
if (tleFixe == "true")
fige = true;
else
fige = false;
$("#" + theId).kendoGrid({
columns:[{
field: "index",
title: "Index",
template: "<span style='font-size: 12px;' title='#= index #'>#= index # </span>",
width: 40
},{
field: "tle",
title: "TLE Id",
template: "<span style='font-size: 12px;' title='#= tle #'>#= tle # </span>",
width: 100
},{
field: "nom",
title: "Intitulé",
template: "<span style='font-size: 12px;' title='#= nom #'>#= nom # </span>"
},{
field : "position",
title : "Position",
width : 70,
attributes : {
"class" : fige ? " " : "fondRougePale"
}
},{
field : "longueur",
title : "Longueur",
width : 70,
attributes : {
"class" : fige ? " " : "fondRougePale"
}
},{
field :"estar",
title :"Estar",
template: "<span class='eStar'><input class='inputeStar' disabled type='text' /> </span>",
width : 250
},{
command: {
name : "destroy",
template: "<a class=\"btn btn-warning btn-mini k-grid-delete\">"
+ "<i class=\"icon-minus-sign icon-white\"></i></a>"
},
title: " ",
width: 40
}
],
dataSource: {
data: leTle,
schema: {
model: {
fields: {
tle: {editable: false},
nom: {editable: false},
estar: {editable: false},
longueur: {editable: fige},
position: {editable: fige}
}
}
}
},
editable: {
mode: "incell",
confirmation: false
},
scrollable : false
});
As you can see, some of my cell can be disabled if my variable "fige" is equals to false. When I try to build my grid with a basic datasource write manually, the grid is okay. Row after row, when the cell have to be disabled, they are.
Unfortunately, when I try to add rows after the construction of the grid, my variable is never including when the cells are set.
Here is the code :
var vgrid = $("#tleSelected").data("kendoGrid");
var datasource = vgrid.dataSource;
var nbLines = vgrid.dataSource.total();
//Booleen de test
if (fige == "true")
tfige = true;
else
tfige = false;
var newRecord = { index : nbLines+1, tle : tleId, nom: nomChamp, estar: "", position: position, longueur: longueur, fige: tfige}
datasource.insert(newRecord);
So, I am in a situation where my variables are good, but the new lines are not.
Instead of destroying my grid and rebuild them after an update of data, do you know a solution for this case ?
Thanks a lot.