Forum

November 2nd, 2014
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
Select element text in cell edit mode
03/03/2010
18:18
Avatar
dw
Member
Members
Forum Posts: 8
Member Since:
07/06/2009
sp_UserOfflineSmall Offline

With inline edit mode as the user tabs through the input elements, the current value of the element is selected.  With cell editing mode the current value is not selected.  This can be painful for users editing the data in a grid as they have to manually select the text to replace the value.  It would be nice if the text was automatically selected when the user selects the cell to edit.

This seemed like it should be as easy as changing the following line in editCell function grid.celledit.js

function () { $(elc).focus();},0);

window.setTimeout(

 change to:

window.setTimeout(function () { $(elc).focus();$(elc).select();},0);

However, it actually took quite a bit more changes to make the focus stay on the element at the right times.  And for some reason IE seemed to need a delay built into the setTimeout call to make this work in all scenarios.  If you would like the code, I can post it, but I am sure it can probably be done better. 

Thanks for considering the change!

29/03/2010
13:47
Avatar
Seroczynski
The Netherlands
Member
Members
Forum Posts: 17
Member Since:
10/02/2010
sp_UserOfflineSmall Offline

I was just thinking of a way to archieve this when I came across your topic. Obviously I would be intrested in more of your changes to the code, and maybe some others as well.

However, I'd like to see this as an future option in jqGrid. The exact same argument on why the OP wanted to archieve this can be applied to my company.

12/04/2010
16:59
Avatar
ben
Member
Members
Forum Posts: 9
Member Since:
19/10/2009
sp_UserOfflineSmall Offline

If I read you correctly, you should be able to achieve the desired effect without needing to alter jqgrid's code by adding an afterEditCell event handler.

afterEditCell: function afterEditCell(rowID, cellname, value, iRow, iCol) {
 $("#" + this.id + " tbody>tr:eq(" + iRow + ")>td:eq(" + iCol + ") input, select, textarea").select();
}

On the other hand, one might want to have a more excel-like behaviour (we're talking of data grids after all) and place the caret depending on where the user clicked.

Therefore, I'm not really confident selecting the content of a cell after it starts being edited is the most "standard" or most ergonomic behavior from a user perspective. It probably depends of what kind of data is being edited and how the user wants to edit it (e.g. not placeing the caret where the user clicked would be painful to the user if all he wants is to correct a spelling mistake on the 12th character of a 20 characters string).

But we probably both agree the current behavior (just enter "edit" mode) is the least ergonomic.

Still, as it is a common denominator, it seems quite appropriate.

16/04/2010
17:04
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello ben,

Thanks. As you said we should provide mechanisms and not ready solutions. Let say that after some time another user want that they want not to select a value

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.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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