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
Conditional select column contents
29/03/2010
22:46
Avatar
Pete
Member
Members
Forum Posts: 100
Member Since:
01/09/2008
sp_UserOfflineSmall Offline

When I construct the page that hold my grids, I load all of the select values into global variables to reduce the number of round trips to the server the application has to make.  When I have an inline edit with a conditional select (where the contents of another select will change based on what is chosen in a select column) I simply swap the HTML attribute of the conditional select with select values I want.  This has worked great for several months.

But there is a problem with this approach because when the grid populates the select value of the editoptions, I can only designate one global variable in the editoptions e.g. editoptions: colLocations.  Since I swap the value of colLocations when onChange is fired on the column, colLocations might have values 1,2,3,4 initially and then have values A,B,C,D later after the swap. 

So the problem is that colLocations needs to change based on the value the grid loads in another column.  What actually happens is that the column ends up with blanks when the grid loads because the value isn't present in the colLocations which is statically filled when the page loads. One workaround I tried was to put all possible select values into the column select, but then the column values aren't valid for certain combinations of columns. I'd rather load the select values dynamically as each row loads in the grid.

So the question is, when you want select values to be conditional on a column as the grid *loads*, what is the best approach?  Since I already have all the values I need loaded into global variables in the javascript, the optimal solution would be able to call a javascript function to load the correct select values based on value of the column as each row is constructed but I haven't found an event to capture that would allow me to do this.  I took a look at dataEvents but I am not sure if that would work.

Any suggestions?  Thanks,

Pete

03/04/2010
13:35
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

I'm not sure if this will solve the problem, but editoptions value can be defined as function

http://www.trirand.com/jqgridw.....ditoptions

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