Search in the middle of a column by default in jqGrid with toolbar search

前端 未结 3 1742
轮回少年
轮回少年 2021-01-01 04:21

After reading the jqGrid wiki (and taking example from: Case insensitive search in jqGrid including hidden fields), I cannot find what I want to do.

Is there any se

3条回答
  •  不知归路
    2021-01-01 04:34

    $(document).ready(function() {
      colNamesData = [ 'Description']
    
      {name:'description',index:'description', width:130, sorttype:"text", search:true, editable:true, edittype:"textarea", editoptions: {rows:"5",cols:"25",maxlength:"255"}, stype:'text', searchoptions:{sopt:['cn', 'nc', 'bw', 'bn', 'ew', 'en']}},
    
    $("#description_table").jqGrid({
          datatype: "local", 
          height: "auto",
          autowidth: true,
          ignoreCase: true,
          colNames: colNamesData, 
          colModel: colModelHash,
          pager: '#pager',
          rowNum:10,
          rowList:[10,25,50,100],
          sortname: 'date',
          sortorder: 'desc',
          viewrecords: true,
          editurl:"/url_name.json", 
          caption: 'Description'
     data:<%= raw @jqgrid_table.to_json %>
       });
    
       jQuery("#description_table").jqGrid('navGrid','#pager',{del:false,add:true,edit:false},{}, {modal: true,afterSubmit:processAddEdit,recreateForm:true, afterComplete:reloadJqGrid}, {modal: true}, {multipleSearch:true});  
    

    Now if your text contains "here i go" and if you search "go", it will surely search, it works for me.

    Give a try and reply if it doesn't.

提交回复
热议问题