Forum


01:22

19/08/2009

Hello!
I have tried searching for this problem on this forum and inside the documentation, but have not found an answer for the following:
I am using jqgrid and the cellEdit feature. And it works quite well.
Now, I am wondering if the following is a default configuration or a bug:
Whenever I edit a cell that loads with a value and change it to nothing, it comes back to the previous value!
Example
Before: "test"
Change to: "test2"
Result after refresh: "test2"
That is, as expected
but the following is not what I want
Before: "test"
Change to: "" <-- nothing
Result after refresh: "test"
That is, not what I expected or want. I would like the cell to be empty!
I have tried the following:
-----------------------------------------
afterSaveCell:function(rowid,fieldname,value,iRow,iCol){
if(value == '') {
alert("empty!");
jQuery("#list").setCell(rowid,fieldname," ");
}
},
-----------------------------------------
I have also tried, undefined or null, but still does not work
And the alert works when I leave the cell empty, so it seems like it is intercepted correctly, but when I refresh the previous content of the cell comes back!!
How do I change that?
Thanks
nisse
07:00

Moderators
30/10/2007

Hello,
This is because we use setCell to store the value and if it is empty we do not set the new value.
Now maybe you should use beforeSaveCell to do this - something like
beforeSaveCell : function (rowid,colName, value, iRow,iCol) {
if (value == "" ) return " ";
else return value;
}
Also some other note - if you save the value to the server check if you handle empty values.
Best 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.
03:00

Moderators
30/10/2007

Hello,
Thanks I have fixed this bug in cellEdit in gitHub.
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.
Most Users Ever Online: 715
Currently Online:
55 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