0
votes

I have a grid. The first column is a checkbox for each row. The second column has two buttons for each row: edit and delete. Clicking on the edit button invokes inline editing. I simply want to disable inline editing for the all rows in the grid. I want to show a form when the edit button is clicked.

I am unable to find a decent answer to this question. I did find a few related posts at SO but they seem unclear to me.

Thanks and regards.

2

2 Answers

0
votes

This is what I did, pretty ugly, but it works. My gut feel is that there must be better solution.

$(grid_selector).jqGrid({
....

                onSelectRow: function(id){
                    jQuery(grid_selector).restoreRow(id); 
                        $('#jSaveButton_' + id).hide();
                        $('#jCancelButton_' + id).hide();
                        $('#jEditButton_' + id).show();
                        $('#jDeleteButton_' + id).show();                       
                },
....

});

Hope this helps someone. Still wait for better solution. But there is a problem with it, the edit button does not invoke a form anymore, which I will try to find a solution.

0
votes

Try using some thing like this , here is an sample when you initialize your grid

{
  name: 'Question', index: 'Question', width: 80, align: 'top', editable: true,
                    editoptions: {
                        dataInit: function (el) {
                            $(el).attr('readonly', true);
                        }
                    }
                },