Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
Insert restoreRow call with the current selected rowId inside of grid.formedit.js
15/09/2010
15:20
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

Hello Tony!

I have a small suggestion. If some jqGrid will support both inline editing mode and form editing, then one have to use restoreRow inside of beforeInitData event handler for example. If one don't do this, the data in the form will be filled with the <input> elements from the inline editing. See http://www.ok-soft-gmbh.com/jq.....tm as an example. Is it not a good idea to call restoreRow with the selected rowId inside of standard jqGrid code of form editing? Not all users know how to fix the problem.

Best regards
Oleg 

24/11/2010
13:12
Avatar
ram2010
Member
Members
Forum Posts: 43
Member Since:
13/01/2010
sp_UserOfflineSmall Offline

Hi Oleg

I am facing the same issue. I guess this issue still exists in the current jqgrid version? I noticed in your example it works fine. What code updates do I need to make to ensure that a grid with both inlineedit and form editing works?

Also on something related to this, I am using the struts2-jquery plugin which uses jqgrid 3.7.2 at the moment. Currently we dont have the capacity to add our own customized buttons on the grid using the this plugin. My idea is to add a Copy button, then when a row is selected, I will invoke the logic of 'Form Editing' to populate the row selected and then obviously change the unique id in the form to null/empty to mimic a new record. Is this possible to do? If so can you assist with any suggestions?

Thanks.

25/11/2010
13:39
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

Hi ram2010,

you should just look inside of the source of the demo page which I used. You will see the following code:

var grid = $("#list");
var lastSel;
grid.jqGrid({
    //...
    '#pager',
    onSelectRow: function(id) {
        if (id && id !== lastSel) {
            grid.jqGrid('restoreRow',lastSel);
            grid.jqGrid('editRow', id /* ... in case of the client editing*/);
            lastSel = id;
        }
    }
});
grid.jqGrid('navGrid','#pager',
    {}, //options
    {
        height:280,
        reloadAfterSubmit:false,
        beforeInitData: function() {
            // close the inline editing mode
            grid.jqGrid('restoreRow',lastSel);
        }
    } // edit options
);

So you should just call restoreRow(lastSel) every time before start of the the form editing (inside of your custom beforeInitData event handle).

My main suggestion in the feature request was to make modification in the code of the jqGrid. For example if one insert the following code fragment

if (rowid!=="_empty" && typeof($t.p.savedRow) !== "undefined" &&
    $t.p.savedRow.length > 0 && $.isFunction($.fn.jqGrid['restoreRow'])) {
    for (var i=0;i<$t.p.savedRow.length;i++) {
        if ($t.p.savedRow[i].id == rowid) {
            $($t).jqGrid('restoreRow',rowid);
            break;
        }
    }
}

before the call of the beforeInitData (see https://github.com/tonytomov/jqGrid/blob/master/js/grid.formedit.js#L796 and https://github.com/tonytomov/jqGrid/blob/master/js/grid.formedit.js#L843) then you will don't need to do anything in your code (see the code used modified jqGrid source).

I hope that Tony makes the corresponding changes in the code of grid.formedit.js.

Best regards
Oleg 


04/12/2010
12:55
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

Also implemeted. Little changed, but the end goal is achieved.

Kind Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
16 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information