jqGrid > datatype : "local" > get and save (at once) all edited cells of a column ?
- by Qualliarys
Hi,
i have a grid with a datatype = "local". The data are an array as follows :
var mydata = [{id:1,valeur:"a_value",designation:"a_designation"}, {id:2,...}, ...];
The second column (named valeur) is the only editable column of the grid (editable:true set in colModel)
In the pager of the grid, i have 2 buttons.
One to edit all cells (at once) of the column named valeur:
$("#mygrid").jqGrid('navButtonAdd','#pager',{caption:"Edit values",
onClickButton:function(){ var ids = $('#mygrid').jqGrid('getDataIDs');
for(var i=0;i<ids.length+1;i++){ $('#mygrid').jqGrid('editRow',ids[i],true);}
}});
and another one to save (at once) all the changes of the edited cells:
$("#mygrid").jqGrid('navButtonAdd','#pager',{caption:"Save changes",
onClickButton:function(){var ids = $('#mygrid').jqGrid('getDataIDs');
for(var i=0;i<ids.length+1;i++){
... ??? ...
}}});
when i use :
var rd = $("#mygrid").jqGrid('getRowData',ids[i]);
alert("valeur="+rd.valeur);
for each display i get something like that:
valeur=< input class="editable" role="textbox" name="valeur" id="1_valeur" style="width: 98%;" type="text" ...
So, when cells are in edition mode, all rd.valeur are an input text tag !
when they are not, i get the initials values of the cells !
How to get and save all changes of this column (all cells in edition mode)?