2

I'm trying to implement a jqGrid with editable cells:

var myGrid = $("#mygrid").jqGrid({
            datatype: 'local',
            data: mydata,
            colModel: [
                    { name: 'Serial', width: 1040, editable: true, edittype: 'text' }
                ],
            rowNum: 10,
            rowList: [10, 20, 30],
            pager: '#mypager',
            sortname: 'Serial',
            cellEdit: true,
            viewrecords: true,
            sortorder: "desc",
            onSelectRow: function(id){
                if(id && id!==lastSel){
                    jQuery('#mygrid').restoreRow(lastSel); 
                    lastSel=id; 
                }
                jQuery('#mygrid').editRow(id, true); 
           }
        });
        myGrid.jqGrid('navGrid', '#mypager', { edit: true, add: false, del: false, search: true });

However, everytime I try to edit a cell, it allows me to write on it but as soon as I click on other row or even outside the grid, the text dissapear.

Another thing, everytime I hit "enter" it tries to submit something because it shows me the following message: "No url is set".

And of course, I only want to use this grid 'locally'. After editing the grid the user will have to click on a "Submit" button that is included in the .html and then I will manage the data inserted on the grid.

Thx.

tina
  • 225
  • 2
  • 4
  • 13

1 Answers1

9

To be able to use cell editing locally (you use cellEdit:true) you have to use cellsubmit:'clientArray' property.

On the other side you use also editRow function, so you want to use Inline Editing. To be able to use Inline Editing locally you should define editurl:'clientArray' (see documentation here).

More then that you use also myGrid.jqGrid('navGrid', '#mypager', { edit: true, ...}) which enable Form Editing, which has not full local editing support.

I recommend you to use just Inline Editing and include editurl:'clientArray' to the options of your jqGrid. The cell editing (cellEdit: true) and Form Editing should be removed.

Oleg
  • 220,925
  • 34
  • 403
  • 798