Forum
02:45
30/08/2013
I have set up a jqgrid which is populated using a jsonstring from my servlet. I am trying to use the jqgrid form editing to add a new row. My grid only contains two columns: product and edit (only product is editable). I want to add rows to the grid without sending the data to my servlet but I am unsure how. So far I have stopped the error "no url set" by using cellsubmit: 'clientArray', cellEdit: true, editurl:${dummyUrl} but nothing is added to the grid.
I have seen a forum post suggesting to use "beforeSubmit : function(postdata, formid)" but I am unsure how to add the postData to the jsonstring in the function.
My code:
jQuery("#productTable").jqGrid({
jsonReader: {
root: "products",
repeatitems: false,
cell: "",
id: "id",
},
datatype: "jsonstring",
datastr: ${productData},
height: 100,
loadonce: true,
colNames:['Product', 'Edit'],
colModel:
[
{name:'product', index:'product', width:150, editable:true},
{ name:'edit',index:'edit', width: 50, align:'center', sortable: false, search: false,
formatter:function(){
return "<span class='ui-icon ui-icon-pencil'></span>"
}},
],
caption: "Products",
pager: "#productPager",
pgbuttons: false,
pgtext: null,
viewrecords: true,
editurl: ${dummyUrl},
cellEdit: true,
cellsubmit: 'clientArray',
gridComplete:function(){
jQuery("#productTable").jqGrid('navGrid',"#productPager",{edit:false, add:true, del:false, search:false, refresh:false});
}
});
Most Users Ever Online: 715
Currently Online:
33 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66