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
Selects returning option string instead of value
06/08/2009
22:41
Avatar
Rowan
Guest
Guests

I'm working with editable rows and when I use getRowData on a row that contains a select it returns the option text where I require the option value

eg

<select>

<option value='1'>Value 1</option>

<option selected='selected' value='2'>Value 2</option>

</select>

I expect it to return '2' but instead its returning 'Value 2'

Is this a bug or do I need to get the value a different way?

Cheers

07/08/2009
00:07
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

This is true. In the grid we have the string, but not the value. The getRowData return what is in the column.

Use custom unformat function to do that - (I f you go to do this use the last development from GitHub or wait for some days.)

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.

18/08/2009
09:36
Avatar
markw65
Member
Members
Forum Posts: 179
Member Since:
30/07/2009
sp_UserOfflineSmall Offline

Isnt there an oversight in $.unformat? All the built in formatters are handled there, except for “select”.

Also, shouldn't there be an equivalent to getRowData that /does/ unformat the data (or did I miss it)? I would have expected it to be the default… the data gets formatted when its put into the grid, shouldnt it be unformatted when you take it out? Formatting is pure presentation – Im normally interested in the data value, rarely how its being displayed.

Mark

18/08/2009
11:21
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

It is done. Will publish the fix tomorow in GitHub ( need some testing)

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.

25/08/2009
22:56
Avatar
markw65
Member
Members
Forum Posts: 179
Member Since:
30/07/2009
sp_UserOfflineSmall Offline

Im having problems with unformat and getRowData (using latest from github).

It looks to me like getRowData is broken, but perhaps Im missing something obvious.

getRowData calls: $.unformat($(this).html(),{colModel:$t.p.colModel[i]},i)

Note, the first parameter is the html contents of the cell, as a string.

But $.unformat then uses $(cellval).text() - which for me is always returning the empty string (since, in general cellval wont be a selector that matches anything on the page!).

Im guessing that getRowData should just pass in this (it fixes the problem for me)

Mark

26/08/2009
17:15
Avatar
Keith Ivey
Washington, DC, USA
Member
Members
Forum Posts: 9
Member Since:
07/04/2009
sp_UserOfflineSmall Offline

It looks like the first (cellval) argument of $.unformat() was changed from a string to a jQuery object or something, but not all the places where it is called have been updated. I guess it still works as long as the cell contents can be recognized by jQuery as an HTML fragment, but that's not usually going to be the case. It works for a select, which is probably what Tony's been working on most recently, but not for '' or 'foo', for example, and cell values like 'input' or 'body' are going to really mess things up. And I've been getting warnings when I have cells containing characters like '/' and '!' that are invalid in selectors.

I'm not sure what the fix is, but the first argument probably needs to be either the jQuery object corresponding to the cell (or maybe the DOM object), in which case it shouldn't be called "cellval", or a string with the contents of the cell, in which case $.unformat() needs to handle it differently.

30/08/2009
10:20
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Thanks Mark. Thanks Keith.

It is true. Will be fixed.

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:
82 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