【问题标题】:ignoreCase sorting is not working on columnignoreCase 排序不适用于列
【发布时间】:2014-08-08 10:45:08
【问题描述】:

在Jqgrid我的专栏如下,

{name : 'name',editable:true,width:120,sorttype:'string'},

但它提供了区分大小写的排序,如下所示。

- product Sales Agent
- email Queue
- default Queue
- Trouble Ticket
- Billing & Payment

我也尝试了 ignoreCase:true 但它不起作用。 我需要通过忽略大小写来完成排序,如下所示,

- Trouble Ticket 
- product Sales Agent 
- email Queue 
- default Queue 
- Billing & Payment

知道这怎么可能吗?

            colNames:['questionId','Name','Answer','Show','Edit','Option'],
            colModel : [
                {name : 'questionId',sorttype:'int',align:'left',editable:true, hidden:true},
                {name : 'name',editable:true,width:120,sorttype:'text',ignoreCase:true,soratble:true},                  {name : 'answer',align:'left',width : 400,sorttype:'string',editable:true},
                {name : 'enable',align:'center',width : 60,sorttype:'string',editable:true, formatter : formatEnable},
                {name : 'edit',editable:false, formatter:addEditButton,align:'center',width:50},
                {name : 'feedbackOptions.optionId',editable:false, align:'center', hidden:true},

            ],
            jsonReader : {root: "rows",
                  page: "page",
                  total: "total",
                  records: "records",
                  repeatitems: false
            },      
            multiselect : true,
            height: '170px',
            paging : true,
            emptyrecords : "<spring:message code='label.norecords'/>",
            viewrecords : true,
            rowNum : 10,
            rowList : [10,20,30],
            pager : "#pager",
            loadonce : true,                
            footerrow : false,
            userDataOnFooter : true,
            altRows : true,
            loadonce:true,
            loadComplete: function (data) {
                $('#buttonDiv').show();
              }
            }); 
            jQuery("#list").jqGrid("navGrid","#pager",{del:false,add:false,edit:false, search:false, refresh:false});
            },
            error:function(xhr,ajaxoptions,thrownError){

            }
    }); 
}

【问题讨论】:

  • 你真的需要 Java 吗?

标签: javascript jquery jqgrid


【解决方案1】:

尝试将sorttype:'string' 更改为sorttype:'text'

【讨论】:

  • 尝试删除任何属性排序类型。只保留一列。我认为取第一个满足的属性。
【解决方案2】:

IgnoreCase: true添加到jqgrid的选项而不是列。

【讨论】:

    【解决方案3】:

    如果您使用的是 3.8 版本的 jqGrid。尝试在 grid.base.js 上进行如下更改

    将 _usecase 字段设为 false 并尝试。

    来自:函数(来源){ …… _用例=假, }

    同样的问题已经在后面的版本中解决了,不需要再改了。

    【讨论】:

      【解决方案4】:

      我知道这是一个老问题,但我在工作时不小心掉到了这里。如果你在你的专栏中这样尝试呢?

      您现在的专栏(或问题所在的任何地方):

      {name : 'name',editable:true,width:120,sorttype:'text',ignoreCase:true,sortable:true}
      

      使用一些JS技巧的ignoreCase函数的列:

      {name:'name', editable:true, width:120, sortable:true, sorttype: function(cell,obj){
          return cell.toLowerCase()}
      };
      

      注意cell 包含单元格的字符串值,因此当您想要对 jqGrid 中的元素进行排序时,您必须使用它。

      希望对你有帮助

      【讨论】:

        猜你喜欢
        • 2018-12-10
        • 2023-03-16
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多