Redirect to jqGrid edit form directly without displaying the grid
Asked Answered
R

2

6

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

Ruhl answered 3/10, 2013 at 17:50 Comment(1)
Could you write any comments on the answers on your question?Archdiocese
A
3

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();
Archdiocese answered 10/10, 2013 at 22:21 Comment(5)
Got it! What I missed is to use loadComplete event. Didnt' know it was so easy.Ruhl
Hi I am trying to use my own custom edit form. Is it possible if yes mean please help me how to do. else guide me alternatively for thisSchuler
@KumarShanmugam: Yes, navButtonAdd allows you to add custom button which can create your custom edit form. Alternatively you can use editfunc, addfunc and delfunc parameters of navGrid.Archdiocese
as usual your answer saved my day... Thanks a lot @Oleg. I used this for add record option. And now trying to implement for search record.Maskanonge
I'm having little issue in this. I am using this for add record. If I click on the save button data posted successfully. But I want to close the add form. I tried closeAfterAdd:true. It is closing the form. But I can't click anywhere in current window after close. @ArchdioceseMaskanonge
M
1

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.

Masson answered 10/10, 2013 at 14:45 Comment(2)
Hi I am also trying the same will you please share me how to call the own custom edit form.Schuler
@KumarShanmugam - Add an edit button to your grid, and from the handler just open a jQuery UI Dialog (or your preferred dialog control).Masson

© 2022 - 2024 — McMap. All rights reserved.