Forum
17:37
05/03/2012
Hi everybody,
in InlineEditing when adding a row with "addRow" Method and "keys:true" and afterwards hitting "Enter" the "oper" – property in the AJAX Call correctly contains "add":
When using the "saveRow" – method after adding a row with "addRow" the "oper" – property in the AJAX Call contains "edit":
Seems to be a Bug
Here is the code regarding the screenshots:
JS:
....
$('#add')
.button()
.click(function() {
$('#test').jqGrid(
'addRow',
{
addRowParams: {
keys:true
}
}
);
});
$('#edit')
.button()
.click(function() {
$('#test').jqGrid(
'editRow',
$('#test').jqGrid('getGridParam','selrow'),
{keys:true}
);
});
$('#save')
.button()
.click(function() {
$('#test').jqGrid('saveRow',$('#test').jqGrid('getGridParam','selrow'));
});
....
HTML:
<button id="add" type="button">Add</button>
<button id="edit" type="button">Edit</button>
<button id="save" type="button">Save</button>
22:03
05/03/2012
As I downloaded jqGrid a few days ago and as you can see here:
I AM currently using jqGrid 4.4.5, so the bug seems NOT to be fixed..
23:33
10/08/2009
In the case there are misunderstanding. saveRow is old method. It should really always send oper=edit to the server if no other oper property are defined inside of extraparam option of saveRow method.
Inline editing don't suppurt currently any options assosiated with editing row. So I personally prefer usage of editRow with keys: true option. I never call saveRow explicitly in my code. In the way editRow calls internally with the options which I specified for editRow when the user press ENTER key.
If you use saveRow method you are responsible to call it with the correct options. For example you can first test the class of the row which you need to save. If it has class jqgrid-new-row then the row was created by addRow method. In the case you can call saveRow and include {oper: "add"} as the extraparam option of saveRow method. I recommend you to examine the code of inlineNav in the body of if(o.save) {...}. It does exactly what I described.
If you want that this do saveRow internally it will be feature request and not a bug report.
Best regards
Oleg
13:09
05/03/2012
>In the case there are misunderstanding. saveRow is old method. It should really always send oper=edit to the server if no
> other oper property are defined inside of extraparam option of saveRow method.
OK, I think that would be worth mentioning in the docs as there one can nowhere read about that it is even POSSIBLE to "overwrite" such an internal generated property as "oper" is.
>Inline editing don't suppurt currently any options assosiated with editing row. So I personally prefer usage of editRow with
> keys:true option.
When you have a textarea/multiline textbox in InlineEditing pressing Enter in it generates a new Line in the textarea and doesn't trigger the InlineEditing saving action.... or is there a way to redefine the "saving key" from "Enter" to "CTRL-S" for example?
>I never call saveRow explicitly in my code. In the way editRow calls internally with the options which I specified for
>editRow when the user press ENTER key.
Then I'm wondering why this method exists at all and why it es explicitly mentioned in the docs in the "InlineEditing" Section...
Till today I assumed, that one can either call "saveRow" manually or that it (=exactly the same) is triggerd by hitting "Enter" and "keys:true"... so in the last case jqGrid internally calls a completely different method and does not exactly the same than "saveRow" does? Why? Not very consitent, is it? I normally would expect, that an action ("Save this row" in this case) always leads to exact the same behaviour/result no matter what it is used to trigger it...
>If you want that this do saveRow internally it will be feature request and not a bug report.
As mentioned above, "saveRow" is described explicitly in the "InlineEditing" section.
That jqGrid behaves different if saving a row fired by "keys:true" and "pressing Enter" or fired by a manual call of "saveRow" is IMHO not very consistent... and that this is even not mentioned in the docs turns things even worse, I think...
And as a plus: one has to check jqGrid - internal used / generated classnames by oneself for deciding if a row is added or edited despite jqGrid is able to do that by itself already as it does with the "keys:true" - thing? What if jqGrid devs rename the class name? Then you have to refactor all code... (BTW: already happend for example when adding a new row, the "id-prefix" of every input element in the row changed from "new_row" to "jqg[0-9]*")
13:41
10/08/2009
In my last post I tried to explain you the current state of inline editing. Nothing is perfect in the world and jqGrid in not an exception: documentation, code, design...
Many things you can do yourself: improve wiki documentation of jqGrid, post pull request with improvements of jqGrid code and so on. I do myself such things regulary.
I agree with many remarks or suggestions which you wrote, but I can repeat, that in my opinion you described not a bug in jqGrid. You just used saveRow in a wrong way (I mean the existing not perfect inline editing which we all use).
Best regards
Oleg
13:53
05/03/2012
>In my last post I tried to explain you the current state of inline editing. Nothing is perfect in the world and jqGrid in not an
>exception: documentation, code, design…
Sure I'm absolutly with you and that jqGrid is functioning the way it does till today with that many functionalities is great (and a LOT of work as I can imagine)... one - as a "user" of jqGrid - simply has to know about such "specialities"...
>Many things you can do yourself: improve wiki documentation of jqGrid, post pull request with improvements of jqGrid code and
>so on. I do myself such things regulary.
I could have a try understanding the jqGrid code so far not sure if I'm deep enough in pure / hardcore JavaScript developing even if I would not call myself a newbie 😉 Will have a try where / with what I could help...
Greetings also from Germany as I noticed only now 😉
16:31
05/03/2012
Just to complete this post:
I solved it as you suggested with this code modifications in my example:
.button()
.click(function() {
rowid=$('#test').jqGrid('getGridParam','selrow');
$('#'+rowid).hasClass('jqgrid-new-row') ? oper="add" : oper="edit";
$('#test').jqGrid('saveRow',
rowid,
{"extraparam" : {"oper":oper}
});
});
Thx a lot for your assistance
Most Users Ever Online: 715
Currently Online:
47 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.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66