Retrieve the column values of jqgrid dynamically -
here code of jqgrid.
$("#grid").jqgrid({ url:$url, editurl:"serivce.php", datatype: "json" , mtype:"post", colnames:["test"], colmodel:[ {name:"test",index:"test", width:150,align:"center", editable:true, edittype:"select", editoptions:{size:1, dataurl:"../someurl.php?param1=parm } }, ], rownum:10, rowlist:[10,20,30], add: { top:30, left:20 }, edit:{ top:30, left:20 }, jqmodal: true, pager: "#page", sortname: "id", viewrecords: true, sortorder: "asc", shrinktofit: true, height: "auto" }); '; $("#grid").setgridparam({ondblclickrow: function(rowid) { var rowdata = jquery("#grid").getrowdata(rowid); jquery(this).jqgrid("editgridrow", rowid, { closeafteredit:true, beforeshowform: function(form){ // force data value retrieve here }, aftersubmit:function() { $("#grid").jqgrid("setgridparam", {datatype: "json"}); return true; } }); } // end of ondblclickrow}); }); ' ;
the server php code of dataurl :
$values = getworkingvalues($param); echo '<select>'; foreach($values $value){ echo "<option value='" . $value . "'>" .$value . "</option>"; } echo "</select>";
how force retrieve of values in "test" column?
example, every time grid open editing?
the version using jqgrid 3.6. thanks
you can try add recreateform: true
option options of editgridrow
(near closeafteredit:true
).
i strictly recommend update jqgrid. jqgrid 3.6 7 years old in web development. 1 had @ time ie4 , ie5 published. no web browsers supported now. try use version stone age of web development. not able find documentation old version. recommend update free jqgrid 4.9.2 can download github, nuget, npm or use directly cdn (see the wiki article). way meaning of recreateform
option different in different versions of jqgrid. if use free jqgrid don't need use recreateform: true
option solve problem.
a recommend additionally set cache-control: private, max-age=0
http header in server response of dataurl
. in way sure previous request not cached on client side , web browser make corresponding ajax request every time.
Comments
Post a Comment