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
Checking if a row is selected
29/05/2010
06:19
Avatar
michaelg
Member
Members
Forum Posts: 51
Member Since:
10/04/2010
sp_UserOfflineSmall Offline

Hi there,

Quick question - when multiselect is turned on, is there a way to check if a row is selected or not other than looping through the selarrrow aray?  I am wondering this because it seems that performance would be better if you didn't have to loop through the array.

Thanks,

Michael

29/05/2010
07:38
Avatar
DaElectric
Member
Members
Forum Posts: 16
Member Since:
15/05/2010
sp_UserOfflineSmall Offline

What information do you allready have about the row.

Do you have the row id? Or the value of the field that is marked as the key?

It creates the row as defined like this. Notice that the id of the row is the same as the key value.

<TR id=11 class="ui-widget-content jqgrow ui-row-ltr ui-state-highlight" role=row aria-selected=true><TD title=11 role=gridcell aria-describedby=list2_id>11</TD><TD title=2007-10-06 role=gridcell aria-describedby=list2_invdate>2007-10-06</TD><TD title="Client 1" role=gridcell aria-describedby=list2_name>Client 1</TD><TD style="TEXT-ALIGN: right" title=600.00 role=gridcell aria-describedby=list2_amount>600.00</TD><TD style="TEXT-ALIGN: right" title=120.00 role=gridcell aria-describedby=list2_tax>120.00</TD><TD style="TEXT-ALIGN: right" title=720.00 role=gridcell aria-describedby=list2_total>720.00</TD><TD title="" role=gridcell aria-describedby=list2_note>&nbsp;</TD></TR>

So then you could just do.

$("#tblselector).find("#+KeyValue").hasClass("ui-state-highlight")

This would return tru if it was selected and false if it were not selected.

This leads me to an intresting issue of having multiple grids on the same form that have rows that happen to have the same key value.

Becuase my tables use an autogenerated id field for thier primary key it is possible that if I put 2 grids on the same page that I could possibly wind up with 2 elements on the same page with the same id. This would be disasterous if I were looking for the rows just by the id's.

29/05/2010
08:03
Avatar
michaelg
Member
Members
Forum Posts: 51
Member Since:
10/04/2010
sp_UserOfflineSmall Offline

Hi DaElectric,

Thanks for your reply and solution.  Yep I have the row's ID, and would like to check if that row is selected, that will work for me.

Thats an interesting point you raised about there being 2 tables that have the same ID value for 2 rows.  With your example ...

$("#tblselector).find("#+KeyValue").hasClass("ui-state-highlight")

... that shouldn't be a problem because your only searching in one of the 2 tables (#tblselector)

Cheers,

Michael

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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