javascript - Arbitrary index (column name) for jqGrid search -


i have jqgrid column defined follows

        name : 'idmycolumn',         index : 'idmycolumn',         width : 80,         align : 'right',         search : true, 

the id name (ìdmycolumn) fine sql update operations, not search. how can change name search operation (to id, let's idmysearch)?

so need different sql column update need search. chance so?


further clarification of oleg's question below

  • how fill rowid in grid? integer value of first column
  • is idmycolumn rowid? use key: true in column? no, not rowid
  • which editing mode use? searching use (toolbar searching, searching dialog, both)? inline edit, toolbar search
  • which name need use during sorting idmycolumn column? should column name searching , sorting same? search should "idmysearch", else (sort, ..) "idmycolumn"
  • do use loadonce: true option or not? loadonce: default / false

clarification part ii:

as have not set stringresult = true somewhere (i have checked), default false. parameter hint anyway, thanks.

however, parsing of filter on server side , replace idmycolumn idmysearch. wondering if replace filter name upfront on client side before send filter server.

the solution depends hard methods use. jqgrid provides many options used change behavior of methods or format of parameters send example server. there many callbacks , events allows modify parameters before sending server. it's important understand searching parameters saved inside of postdata option. options inside of object can using $("#gridid").jqgrid("getgridparam"), alternatively can specific option, example postdata option using $("#gridid").jqgrid("getgridparam", "postdata"). returned value the reference of internal object used jqgrid. can modify , jqgrid use automatically modified value. usage of methods setgridparam not needed in case.

thus solution of problem following. add beforesearch callback filtertoolbar method, modifies idmycolumn property of postdata idmycolumn idmysearch:

$("#gridid").jqgrid("filtertoolbar", {     beforesearch: function () {         var postdata = $(this).jqgrid("getgridparam", "postdata");         if (postdata.hasownproperty("idmycolumn")) {             postdata.idmysearch = postdata.idmycolumn;             delete postdata.idmycolumn;         }     } }); 

Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -