Question

I am working in the concrete5 cms, I trying to implement jqgrid in my web application. I did jqgrid view in the form but i dont know howw to edit, delete and all function in the jqgrid.

the problem was if I select the row in the jqgrid and delete, it was deleted in the front view but how to delete in my database and how to pass the sID value to my controller.

enter image description here

var myData = <?php echo json_encode($sl) ?>;

    $("#statGrid").jqGrid({
        caption: 'Status List',
        datatype:'local',
        data: myData,
        mtype:'POST',
        colNames:['sID','Status Name','Type','Description'],
        colModel:[ 
            {name:'status_id',editable:true }, 
            {name:'status_name',editable:true },
            {name:'status_type',editable:true },
            {name:'status_description', editable:true, edittype: 'textarea' } ],
        width: "777",
        height: "auto",
        pager:'#statPager',
        rowNum:5, 
        rowList:[5,10,20,30],
        rownumbers: true,
        viewrecords: true,
        recreateForm:true,
        gridView: true,
        autoencode: true,
        editurl: "editStatus",
        loadui:'enable'

    }).navGrid("#statPager",{add:false, edit:true, view:false, del:true, search:false, refresh:false });

How to pass exact sID through parameter in the grid. please guide me about the jqgrid. to solve this problem. if any mistake in my question sorry, i will develop my question skillthanks.

Était-ce utile?

La solution

I suppose that 'status_id' column contains unique ids which you want to see on the server side in the URL "editStatus". In the case you should add key: true to the definition of 'status_id' column. In the case the value from the column will be used as the rowid (the value of id attribute of <tr> elements of the grid which represent the rows of data). The data, which will be posted to the server during deleting of the row, are described here.

Small remarks to your code. You should replace gridView: true to gridview: true, change width: "777" to width: 777, remove recreateForm:true (bacause it's the option of form editing and not the option of jqGrid). If you need set some common values to colModel like editable:true you can remove the properties editable:true from colModel and uses jqGrid option cmTemplate: {editable: true} instead. See the answer for details.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top