Forum

July 12th, 2025
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
change Navigator url / form editing parameters dynamical
18/09/2010
17:08
Avatar
slowjack2k
Member
Members
Forum Posts: 3
Member Since:
18/09/2010
sp_UserOfflineSmall Offline

Hello,

is it possible to change edit, add, del url and mtype dynamical, or use a function?

I would like something like this:

jQuery("#gird").jqGrid('navGrid','#pager_id', {edit:true,
                                               add:true,
                                               del:true,
                                               search:true,
                                               refresh:true,
                                              }, {url : function(original_url){ return new_url; } mtype: function(original_mtype){return new mtype;}}

Or can I change parameters for form editing after add-button and so on was pressed?

Regards

Jack

19/09/2010
01:25
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

First of all you should remove comma after the refresh: "refresh:true,}" if you have the same problem in your code.

Now to your question. The requirement to use different mtype values I understend good, but having mtype absolute dynamic I don't understend.

You can overwrite url dynamicaly inside of onclickSubmit function. For example below you can find an example from one of my scripts:

jQuery("#gird").jqGrid('navGrid','#pager_id',
                               {edit:true, add:true, del:true, search:true, refresh:true},
         { mtype: "PUT",
            onclickSubmit: function(rp_ge, postdata) {
                rp_ge.url = urlEdit + '/' + postdata.list_id;
            }
         },
         { mtype: "POST" },
         { mtype: "DELETE",
           onclickSubmit: function(rp_ge, postdata) {
                    rp_ge.url = urlEdit + '/' + postdata +
                                '?RowVersion=' + grid.getCell (postdata, 'RowVersion');
                }
         }

The variable urlEdit I define somewhere before. I hope you could use the example to write the code in your case.

Best regards
Oleg

19/09/2010
10:02
Avatar
slowjack2k
Member
Members
Forum Posts: 3
Member Since:
18/09/2010
sp_UserOfflineSmall Offline

Thank you Oleg.  You'r right. It isn't nessecary to change mtype dynamical. You'r example will serve me quite well. It's exactly what I was looking for.

Regards

Jack

19/09/2010
10:15
Avatar
slowjack2k
Member
Members
Forum Posts: 3
Member Since:
18/09/2010
sp_UserOfflineSmall Offline

It works very well Laugh

I made only one minor change insteed of a temporary urlEdit variable I use:

 jQuery("#grid_id").jqGrid('getGridParam','editurl')

You need RowVersion for optimistic locking, right?

19/09/2010
12:41
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

Hi Jack,

I am glad to hear that I could help you. The RowVersion was really needed in the exmple for the optimistic locking. I took the example from the project where the data will be hold on the Microsoft SQL Server and every row in the database has additional column with the non-nullable value of the type timestamp (http://msdn.microsoft.com/en-u.....82776.aspx for details).

On every Edit operation in the jqGrid the value from the RowVersion will be send to the server automatically because the RowVersion column I defined with

hidden: true, editable: true, editrules: { edithidden: false }, hidedlg: true

option. So the value could be used for the optimistic locking. To use RowValue also in Delete operation I had to add the RowValue manualy inside of onclickSubmit as I described befor.

Best Regards
Oleg

Forum Timezone: Europe/Sofia

Most Users Ever Online: 994

Currently Online:
23 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