jquery - JQGrid : sorttype integer sort column as string -
i use jqgrid this:
<@sjg.grid id="gridtable" datatype="json" loadonce="true" href="${remoteurl}" pager="true" gridmodel="mydatalist" navigator="true" navigatoradd="false" navigatoredit="false" navigatordelete="false" navigatorview="true" navigatorrefresh="false" navigatorsearch="false" rownum="20" rownumbers="true" rowlist="10,20,30,50,100" viewrecords="true" multiselect="true" autowidth="true" shrinktofit="true" oncompletetopics="loadcomplete" onfocustopics="onselectrow" onselectalltopics="onselectall" filter="true" filteroptions="{stringresult:true}" footerrow="true" > <@sjg.gridcolumn name="intcolumn" index="intcolumn" title="test int" sortable="true" search="true" sorttype="integer" width="30" searchoptions="{sopt:['cn','eq','ne','bw','bn','ew','en','nc']}"/>
then, when sort column, values sorted string value (1 < 10 < 11 < 2... instead of 1 < 2 < 10 < 11 ...).
how explain behavior?
edit: generated js of jqgrid:
jquery(document).ready(function() { jquery.struts2_jquery.debug = false; jquery.struts2_jquery.loadatonce = true; jquery.scriptpath = "/struts/"; jquery.struts2_jquery.minsuffix = ""; jquery.struts2_jquery.local = "fr"; jquery.struts2_jquery.gridlocal = "fr"; jquery.struts2_jquery.timelocal = "fr"; jquery.struts2_jquery.defaults.indicator="indicator"; jquery.ajaxsettings.traditional = true; jquery.ajaxsetup ({ cache: false }); jquery(document).ready(function () { jquery.struts2_jquery.require("js/struts2/jquery.grid.struts2-3.1.0"+jquery.struts2_jquery.minsuffix+".js"); var options_gridtable = {}; var options_gridtable_colmodels = new array(); var options_gridtable_colnames = new array(); options_gridtable_colmodels_intcolumn = {}; options_gridtable_colmodels_intcolumn.name = "intcolumn"; options_gridtable_colmodels_intcolumn.jsonmap = "intcolumn"; options_gridtable_colmodels_intcolumn.index = "intcolumn"; options_gridtable_colmodels_intcolumn.width = 30; options_gridtable_colmodels_intcolumn.editable = false; options_gridtable_colmodels_intcolumn.sortable = true; options_gridtable_colmodels_intcolumn.resizable = true; options_gridtable_colmodels_intcolumn.search = true; options_gridtable_colmodels_intcolumn.searchoptions = {sopt:['cn','eq','ne','bw','bn','ew','en','nc']}; options_gridtable_colnames.push("int column"); options_gridtable_colmodels.push(options_gridtable_colmodels_intcolumn); options_gridtable.datatype = "json"; options_gridtable.url = "myurlaction"; options_gridtable.height = 'auto'; options_gridtable.pager = "gridtable_pager"; options_gridtable.pgbuttons = true; options_gridtable.pginput = true; options_gridtable.rownum = 20; options_gridtable.rowlist = [10,20,30,50,100]; options_gridtable.viewrecords = true; options_gridtable.autowidth = true; options_gridtable.navigator = true; options_gridtable.navigatoradd = false; options_gridtable.navigatordel = false; options_gridtable.navigatoredit = false; options_gridtable.navigatorrefresh = false; options_gridtable.navigatorsearch = false; options_gridtable.navigatorview = true; options_gridtable.loadonce = true; options_gridtable.filter = true; options_gridtable.filteroptions = {searchonenter:false}; options_gridtable.multiselect = true; options_gridtable.shrinktofit = true; options_gridtable.autoencode = true; options_gridtable.footerrow = true; options_gridtable.rownumbers = true; options_gridtable.onselectalltopics = "onselectall"; options_gridtable.colnames = options_gridtable_colnames; options_gridtable.colmodel = options_gridtable_colmodels; options_gridtable.jsonreader = {}; options_gridtable.jsonreader.root = "mydatalist"; options_gridtable.jsonreader.repeatitems = false; options_gridtable.jqueryaction = "grid"; options_gridtable.id = "gridtable"; options_gridtable.oncom = "loadcomplete"; options_gridtable.onfocustopics = "onselectrow"; jquery.struts2_jquery_grid.bind(jquery('#gridtable'),options_gridtable);
Comments
Post a Comment