douyue8191 2014-01-28 12:34
浏览 73
已采纳

如何在JQGrid视图中添加功能

Hi I working in the concrete5 CMS, its zend based cms framework and mvc pattern

I try to manipulate my data into the jqgridview, it returns data in the gridview but pagination is not working and i don't know how to add the edit, delete and find function in the jqgridview and also i get "undefined" error in the center of the gridview

script:

$(function() {

    $("#eList").jqGrid({
        datatype: "local",
        data: <?php echo json_encode($emplist) ?>,
        pager: true,
        colNames:['Emp ID','Name','Email', 'Role', 'Contact No','Status'], 
        colModel:[ 
            {name:'emp_id',index:'emp_id', width:55}, 
            {name:'emp_name',index:'emp_name', width:90, editable:true}, 
            {name:'uEMail',index:'uEMail', width:100}, 
            {name:'role_name',index:'role_name', width:80, align:"right"}, 
            {name:'emp_contact_no',index:'emp_contact_no', width:80, align:"right",editable:true}, 
            {name:'status_name',index:'status_name', width:80,align:"right"}
        ],
        rowNum:5, 
        rowList:[5,10,20], 
        pager : '#ePage',
        sortname: 'emp_name', 
        viewrecords: true, 
        sortorder: "desc",
        editurl: "local", 
        caption: "Using navigator" 
    });

    $("#eList").jqGrid('navGrid',selector,options,pEdit,pAdd,pDel,pSearch ); 

    $("#eList").jqGrid('navGrid',"#ePage",{edit:true,add:true,del:true}); 

    $("#eList").jqGrid('inlineNav',"#ePage");
});

html

<table id = "eList" >
</table>
<div id = "ePage" >
</div>

please suggest me how to add the functionality, or any good example or demo of jqgrid or any link related to learn the jqgrid

  • 写回答

1条回答 默认 最新

  • dongqiao9394 2014-01-28 13:14
    关注

    To be able to use local paging of data the server (<?php echo json_encode($emplist) ?>) should returns all data and you should include the option loadonce: true. I recommend you to use additionally the options gridview: true and autoencode: true. I recommend you remove all index properties from colModel and add key: true option to the definition of the emp_id column if it's values are unique and so it can be used as rowids (the values of id attribute of <tr> elements).

    You should remove the line $("#eList").jqGrid('navGrid',selector,options,pEdit,pAdd,pDel,pSearch ); which contains undefined variables.

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

报告相同问题?

悬赏问题

  • ¥170 如图所示配置eNSP
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改
  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持
  • ¥15 stata安慰剂检验作图但是真实值不出现在图上
  • ¥15 c程序不知道为什么得不到结果
  • ¥15 键盘指令混乱情况下的启动盘系统重装