jqGrid - 无法选择行甚至id是唯一的

时间:2013-08-24 09:31:38

标签: jquery jqgrid

    url: base_url + 'index.php/user/userlist',
    datatype: "json",
    colNames: [
        'id', 'First Name', 'Lasr Name', 'Email', 'Gender', 'Birthday', 'Address1', 'Address2', 'City', 'State',
        'Country', 'Pin No', 'Mobile No', 'Tel No', 'Pan No', 'Status'
    ],

    colModel:[
    {name:'id',index:'id', width:55},
                {name:'firstname',index:'firstname', width:55},
                {name:'lastname',index:'lastname', width:55},
                {name:'email',index:'email', width:55},   
                {name:'gender',index:'gender', width:55}, 
                {name:'birthday',index:'birthday', width:55},
                {name:'address1',index:'address1', width:55},
                {name:'address2',index:'address2', width:55},
                {name:'city',index:'city', width:55},
                {name:'country',index:'country', width:55},
                {name:'state',index:'state', width:55},
                {name:'pin',index:'pin', width:55},
                {name:'mobileno',index:'mobileno', width:55},
                {name:'telno',index:'telno', width:55},
                {name:'pan',index:'pan', width:55},
                {name:'status',index:'status', width:55},
             ],

    viewrecords: true, //Shows the nice message on the pager

    shrinkToFit: true,
    height: 'auto', //I like auto, so there is no blank space between. Using a fixed height can mean either a scrollbar or a blank space before the pager



    pager: '#userlistpager',
    sortname: 'firstname',
    rowNum: 10,
    rowList: [ 10, 20,30],


    rownumbers: true,
    sortorder: "asc",

我的Json结果

{
"page": "1",
"total": 1,
"records": "8",
"rows": [{
    "id": "1",
    "cell": [
        "1",
        "naresh",
        "kumar",
        "sungonaresh@gmail.com",
        "",
        "0000-00-00",
        "gandji nage",
        "hosur",
        "banglore",
        "India",
        "",
        "0",
        "2147483647",
        "2147483647",
        "46",
        "1"
    ]
}, {
    "id": "2",
    "cell": [
        "2",
        "naresh",
        "kumar",
        "sungonaresh@gmail.com",
        "",
        "",
        "gandji nage",
        "hosur",
        "banglore",
        "India",
        "",
        "0",
        "2147483647",
        "2147483647",
        "46",
        "1"
    ]
}, {
    "id": "6",
    "cell": [
        "6",
        "test",
        "last",
        "kumarnareshmay@gmail.com",
        "male",
        "2012-78-45",
        "sdf",
        "sdf",
        "sdf",
        "India",
        "Chandigarh",
        "0",
        "234",
        "234",
        "234",
        "1"
    ]
}]

}

Id是唯一的,但我无法选择jqgrid中的行

我看到了jqGrid - cant select rows - Cannot call method 'indexOf' of undefined 发布它告诉如果id是唯一的,我们可以选择行。但在我的情况下,我不能..

提前致谢。非常感谢任何帮助

1 个答案:

答案 0 :(得分:1)

我认为您的其他一些代码可能与此代码冲突,因为您提供的代码可以正常工作。 你的例子http://jsfiddle.net/kVex2/ 我希望你的代码正确关闭。 它可能与记录有关,因为你只有3条记录。

 "records": "8",