Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redirect to jqGrid edit form directly without displaying the grid

Tags:

jqgrid

Often I need to edit a single record in a database without the need to display the grid at all. I can hide the grid using CSS or jQuery. What I couldn't figure out is to directly go to the edit form from another webpage while hiding the grid.

I know it's kind of defeating the purpose of having a grid, but it's one of those cases where only a single record should be view and modified by the users similar to the Access single record mode. Is it even possible?

enter image description here

like image 704
devXen Avatar asked Oct 03 '13 17:10

devXen


2 Answers

In general you can just hide so named "gbox" created over the grid and then call editGridRow method with the options which you like to have. As the result you will have the form which close to what you want. I am sure that you have to make some other small problems, but the first look can be like you want. Moreover you can scroll over the rows during editing.

The demo demonstrate what I mean. It displays the following form

enter image description here

The demo uses the following code

$("#list").jqGrid({
    ...
    loadComplete: function (data) {
        $(this).jqGrid("editGridRow", data.rows[0].id, {
            modal: true,
            overlay: 0, // create no overlay
            onClose: function () {
                return false; // don't allow to close the form
            }
        });
    }
}).closest(".ui-jqgrid").hide();
like image 195
Oleg Avatar answered Nov 10 '22 04:11

Oleg


This is one of the reasons I like to use my own custom edit forms, instead of the one built into jqGrid. Then you can just open it like you would from the jqGrid handler (with appropriate parameters of course), no grid required.

like image 39
Justin Ethier Avatar answered Nov 10 '22 05:11

Justin Ethier