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
Set selection when data loaded
27/11/2009
10:16
Avatar
bernie.blakeney
Member
Members
Forum Posts: 5
Member Since:
27/11/2009
sp_UserOfflineSmall Offline

Is there anyway to return the selection state with my data set so that rows will be selected based on data in my db? I save the selected state of each row into a database so the user can re-use a selection but I can't figure out an effiecient way to set the selection from the query.

Thanks

27/11/2009
11:32
Avatar
Rumen[Trirand]
Moderator
Members

Moderators
Forum Posts: 81
Member Since:
08/10/2009
sp_UserOfflineSmall Offline

One way to do it is to pass the selected rows as a javascript array, and then hook the gridComplete event, where you can set selected rows based on the values in the array, e.g. something along the lines of

jQuery('#JQGridID').setGridParam( {gridComplete: function() 

                        {                           

                            var grid = jQuery('#JQGridID');

                            grid.setSelection(selectedRowArray[0],false);

                        }});

Trirand ASP.NET WebForms & MVC components based on jQuery & ThemeRoller

http://www.trirand.net

27/11/2009
11:49
Avatar
bernie.blakeney
Member
Members
Forum Posts: 5
Member Since:
27/11/2009
sp_UserOfflineSmall Offline

Thanks Rumen,

I've tried something like that but it is dreadfully slow.  Here's the code, maybe I'm doing something wrong.

gridComplete: function()
            {
                var uData = jQuery('#list').getGridParam('userData');
                var id_arr=uData.selected.split(",");

                for (var i=0;i<=id_arr.length;i++)
                {
                    jQuery('#list').setSelection(id_arr[i],false);
                }
            }

30/11/2009
12:49
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

It depends how many data you loop.

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.

02/12/2009
16:23
Avatar
bernie.blakeney
Member
Members
Forum Posts: 5
Member Since:
27/11/2009
sp_UserOfflineSmall Offline

Thanks Tony.

I don't have that much data - about 500 rows. Firefox gives me that "a script is running slowly" message after only about 120 records.

It would be really great if in the data I'm returning I could add an attribute to the row element that jqgrid would use to select the row - something like "<row id='1234' selected='Y'>". Then jqgrid could set the value when painting the grid which I assume would be much faster.

Bernie

02/12/2009
16:58
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

You can try to use afterInsertRow - where you can set the selection.

Note that in this case gridview mode should be false.

Please let me know if this is faster.

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