문제

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

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top