doudou5421 2016-11-16 05:23
浏览 493
已采纳

jqGrid排序不起作用

Following is my code. I want to sort the data by clicking on the table header. But it is not working.

 $("#list_records").jqGrid({
                    url: 'ajaxFetchTableInfo.php?table=GET_TRAINING_TYPE',
                    editurl: 'ajaxSaveTrainingType.php',
                    datatype: "json",
                    colNames: ["TRAINING TYPE ID", "TRAINING TYPE NAME", "REMARKS"],
                    colModel: [
                        {
                            label: 'TRAINING_TYPE_ID',
                            name: 'TRAINING_TYPE_ID',
                            index: 'TRAINING_TYPE_ID',
                            editable:true,
                            sortable:true,
                            sorttype: "text",
                            editoptions:{readonly:"readonly"},
                            width: 75                        
                        },
                        {
                            label : 'TRAINING_TYPE_NAME',
                            name: 'TRAINING_TYPE_NAME',
                            index: 'TRAINING_TYPE_NAME',
                            width: 140,
                            editable: true, // must set editable to true if you want to make the field editable
                            editoptions: {size:50, maxlength: 80},
                            editrules:{required: true, maxlength: 80},
                            sortable:true,
                            sorttype: "text",
                            // set options related to the layout of the Edit and Add Forms
                            formoptions: {
                                colpos: 1, // the position of the column
                                rowpos: 2, // the position of the row
                                label: "Training Type Name:", // the label to show for each input control  
                                elmsuffix: "(*)"                 

                            }
                        },
                        {
                            label : 'Remarks',
                            name: 'REMARKS',
                            width: 100,
                            editable: true,
                            edittype: 'textarea',
                            editoptions:{rows:3, cols:45},
                            formoptions: {
                                colpos: 1,
                                rowpos: 3
                            }
                        }
                    ],
                    loadOnce : true,
                    viewrecords: true,
                    altRows: true,
                    width: 780,
                    height: 200,
                    rowNum: 10,
                    rowList:[10, 20, 30],
                    caption:"Training Type Information",
                    sortname: 'TRAINING_TYPE_ID',
                    sortorder: "asc",
                    emptyrecords: "No Records to Display.",
                    //footerrow: true,
                    pager: "#perpage"
                });
  • 写回答

1条回答 默认 最新

  • douteng5673 2016-11-16 05:51
    关注

    You should replace loadOnce : true to loadonce : true. The server should return all data (all pages) from the server (url: 'ajaxFetchTableInfo.php?table=GET_TRAINING_TYPE').

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 宇视监控服务器无法登录
  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥15 DruidDataSource一直closing
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误
  • ¥50 power BI 从Mysql服务器导入数据,但连接进去后显示表无数据