onCellselect,事件未使用默认设置在jqgrid中触发

时间:2011-10-09 14:08:04

标签: jquery jqgrid

我使用所有最新文件设置了jqgrid并且它工作得非常漂亮但我甚至无法使用内部方法来触发基本事件。我错过了什么吗?

这些是包含

<link href="style.css" rel="stylesheet" type="text/css" />
<link href="scripts/css/jquery-ui-1.8.16.custom.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="scripts/css/ui.jqgrid.css" />
<script type="text/javascript" src="scripts/jquery-1.6.4.min.js"></script>
<script type="text/javascript" src="scripts/jquery-ui-1.8.16.custom.min.js"></script>
<script src="scripts/jqgrid/i18n/grid.locale-en.js" type="text/javascript"></script>
<script src="scripts/jqgrid/jquery.jqGrid.min.js" type="text/javascript"></script>
<script type="text/javascript" src="scripts/scripts.js"></script>

这会构建网格

$("#tasklist").jqGrid({
                            url:'gettaskdoc.php',
                            datatype: "json",
                            height:"auto",
                            autowidth:true,
                            gridview:true,
                            sortable:true,
                            colNames:['Id','Done By', 'Project', 'Type','Details','StartDate','EndDate','Time Taken','MthlyHrsLeft','StoredHrsLeft'],
                            colModel:[
                                {name:'idno',index:'idno', width:20},
                                {name:'doneby',index:'doneby', width:80, classes: 'sltuser'},
                                {name:'project',index:'project', width:120, classes: 'sltproject'},
                                {name:'type',index:'type', width:80},
                                {name:'details',index:'details', width:200},        
                                {name:'startdate',index:'startdate', width:70}, 
                                {name:'enddate',index:'enddate', width:70},
                                {name:'timetaken',index:'timetaken', width:50},
                                {name:'mthlyhrsleft',index:'mthlyhrsleft', width:50},
                                {name:'storedhrsleft',index:'storedhrsleft', width:50}
                            ],
                            rowNum:20,
                            rowList:[20,40,60],
                            pager: '#taskpager',
                            sortname: 'idno',
                            viewrecords: true,
                            sortorder: "asc",
                            caption:"Combined Taskdoc",
                            onCellSelect :  function(rowid, index, contents, event) {
                                alert('test');
                                }
                        });
                        $("#tasklist").jqGrid('navGrid','#taskpager',{edit:true,add:false,del:false});

每次点击网格时都会在Chrome上登录错误。

  

122Uncaught TypeError:无法调用未定义的方法'indexOf'   b.jgrid.extend.setSelectionjquery.jqGrid.min.js:122   e.extend.eachjq​​uery-1.6.4.min.js:2 e.fn.e.eachjq​​uery-1.6.4.min.js:2   b.jgrid.extend.setSelectionjquery.jqGrid.min.js:121   b.fn.jqGridjquery.jqGrid.min.js:29   b.fn.jqGrid.each.b.before.click.bind.a.p.datatypejquery.jqGrid.min.js:105   f.event.handlejquery-1.6.4.min.js:3 f.event.add.i.handle.k

1 个答案:

答案 0 :(得分:0)

啊,看起来我缺少jsonReader的定义......奇怪的是它并不是jqgrid网站的所有json演示。

jsonReader : {
    root: "rows",
    page: "page",
    total: "total",
    records: "records",
    repeatitems: true,
    cell: "cell",
    id: "id"
}