Forum
14:39
10/08/2009
Hello Tony,
default parameter of addRow contains rowID: "new_row". As the result the simplest usage of inlineNav with local grid (having editurl: "clientArray") will produce id duplicates if one add multiple rows to the grid with respect of clicking on the "Add" button.
Additional problem is that one can't use function as the value of rowID. So one can't produce unique ids or just different ids in a simple way.
I suggest to fix the code of in the following way (I marked changed places with bold font):
p = $.extend(true, {
rowID : undefined,
initdata : {},
position :"first",
useDefValues : true,
useFormatter : false,
addRowParams : {extraparam:{}}
},p || {});
return this.each(function(){
var $t = this,
rowID = $.isFunction(p.rowID) ? p.rowID.call($t, p) : (p.rowID ? p.rowID : $.jgrid.randId());
...
... in the code below the usage of p.rowID will be replaced to
... the usage of new rowID variable.
...
});
},
I changed the default value of rowID to undefined to force call of in case of the simplest usage of addRow method. Additionally the line
of inlineNav which defines default values of inlineNav should be changed to
Best regards
Oleg
10:49
Moderators
30/10/2007
Hello Oleg,
Thanks. This is ok.
The only thing for me is that the rowID should be set from undefined to null and we should perform check if
we want to add a row with id = 0, then this p.rowID ? p.rowID : $.jgrid.randId()
will produce bad call of randID.
Regards
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.
11:29
Moderators
30/10/2007
Thanks Oleg.
Published in GitHub. You maybe mean :
(p.rowID !== null) ? p.rowID : $.jgrid.randId()
Best Regards
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.
11:59
Moderators
30/10/2007
Oleg,
Ok. Changed, but I think nobody will set a undefined.
Regards
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.
13:26
10/08/2009
Sorry, my last suggestion was based on my *original* code where the value of rowID was undefined. One uses $.extend with input parameters. So one can't ovewrite any other value with the undefined value. If you use null as the default value then rowID will never been undefined, but it's not a real problem. So your previous suggestion will work exacly so good as the last one. Sorry for the misunderstanding.
Regards
Oleg
Most Users Ever Online: 715
Currently Online:
61 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.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66