读书人

jqGrid 省市级联有关问题

发布时间: 2012-12-26 14:39:28 作者: rapoo

jqGrid 省市级联问题

在网上查找了很久,有人竟然说改源码,当时想jqGrid如此强大,不至于到改源码的地步,纠结几天,坑在这地方浪费了不少时间,废话不说,贴代码。

{name:'procode',index:'procode', width:50,align:'center',editable : true,editrules:{edithidden:true},hidden:true,edittype : "select",   editoptions: {   dataUrl:'${ctx}/city/json/pros',   dataEvents :[   { type: 'change', fn: function(e) {   var thisval = $(e.target).val();   $.get('${ctx}/city/json/citys?pro='+thisval, function(data)   { var res = $(data).html();   $("#citycode").html(res);   }); // end get   }//end func   } // end type   ] // dataevents   } // edit option   },{name:'citycode',index:'citycode', width:50,align:'center',editable : true,editrules:{edithidden:true},hidden:true,edittype : "select",editoptions : {value:city_json}},
?注意dataUrl返回的内容是以:<select>/<option value='value'>value</option> </select>字符串形式返回的。指定value后,jqGrid 会通过value的值选定默认值。

读书人网 >Web前端

热点推荐