Forum


03:42

20/11/2008

Hello!
I'm using celledit (jqGrid ver 3.5.3) and wonder if there is any way to make a value selected immediately when enter the cell with celledit. The main purpose is for cells with value=0. When edit a cell like that you have to first erase the "0" and then enter the new value. Otherwise the new value will be the "0" concatenated with the entered value (like 065). It doesn't look very nice.
/birt
11:02

Moderators
30/10/2007

Hello,
Sorry - do not understand.
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.
09:23

20/11/2008

Yes, I know it was kind of cryptic question. I will try to eplain better:
I would like to enter especially numbers/digits to a cell (using celledit) without having to erase to old value first. I would like the old value to be deleted or selected immediately when "opening" the cell. Something like this:
http://i37.tinypic.com/292b1jn.jpg
As I wrote the main purpose is for cells with value=0. When opening a cell like this:
http://i36.tinypic.com/fdhv9c.jpg
If I type a value (56) without deleting the old it will look like this (not desired):
http://i37.tinypic.com/28quiv5.jpg
(But what I want is this:)
http://i38.tinypic.com/2w3xmrd.jpg
I realize that this is maybe not a very big or common problem but do you have any solution that I can try??
regards
birt
00:42

Moderators
30/10/2007

Hello,
use afterEditCell something like this
...
afterEditCell : function(rowid, name, value, iRow, iCol) {
$("#"+iRow+"_"+name,"#mygrid").select();
}
...
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.
19:32

19/08/2009

Hi,
I'd also like to achieve the same effect. The above suggestion works, however if I press Esc to cancel out of cell editing I lose the keyboard navigation (ie pressing the arrow buttons no longer does anything - the focus is else where). The problem does not occur if I change the value of the cell and press Enter. If value is not changed and Enter is pressed the problem still occurs.
Regards,
Jo
08:01

Moderators
30/10/2007

Hello,
Seems like with select() we loose the focus. try select().focus() - not sure if this is the appropriate approach.
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.
08:12

20/11/2008

Thanks Tony!
For me it seems to work with both select() and select().focus() in FF, might be browser dependent?
However, I can feel that the focus sometimes becomes elsewhere after editing a cell in IE8. This happens independent of if the function you suggested is active or not. It looks like if the cell width is decreased and then you can't navigate with the keyboard's arrow buttons any more.
Regards
birt
12:12

Moderators
30/10/2007

Hello,
Also maybe the right code should use setTimeout - i.e:
setTimeout(function() { $(”#”+iRow+”_”+name,”#mygrid”).select().focus();},10);
Good practice is to use setTimeout when you try to focus some element. (instead that the timeout can be 0)
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.
09:30

20/11/2008

Hi,
It is a bit strange because my experience is that it to work the other way, Ok when leaving without save (pressing Esc) and "hangs" when saving (pressing Enter). For text fields I also notice that the width of the current cell is changed a bit when saved. (The right border is moved a bit to the left.) Do you have the same issue?
/birt
Most Users Ever Online: 715
Currently Online:
50 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