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
populate grid column in edit mode depending on another column
15/12/2010
11:56
Avatar
karina
Timisoara, Romania
New Member
Members
Forum Posts: 2
Member Since:
04/06/2010
sp_UserOfflineSmall Offline

Hi,

Given a grid with several columns, let's say first column contains groups, and second one a group's subunits (one-to-many relationship).

Now, in edit mode, I want second column to turn into a dropdown, and I want it to be populated depending on first column (to change a group's current unit, one can choose from a set of units which 'feed' the drop-down, but this is not the whole set of units in database, but a subset depending on the group's id).

I have something like:

{

name: "group",

index: "group",

width: 100,

editable: false

},

{

name: "unit",

index: "unit",

width: 150,

editable: true,

edittype: "select",

editoptions: {

value: unitsForCurrentGroup

}

},

unitsForCurrentGroup is a javascript variable and grid is an inline grid.

I tried to use an onedit - oneditfunc - handler, which is indeed passed the edited row's id (which is equal to group id in my case) and that method returns a group's units and stores them in unitsForCurrentGroup. 

Still no luck, in edit mode my drop down is empty (I suppose the value for editoptions must be known at grid loading time, not just when editing a row?)

Thanks,

Karina

16/12/2010
16:28
Avatar
rmvenancio
Portugal
Member
Members
Forum Posts: 12
Member Since:
09/11/2010
sp_UserOfflineSmall Offline

Karina,

In your group you should have something similar :

editoptions: {
                  value: FunctionToGetTheInitialListofItems(),
                  dataEvents: [
                      { type: 'change',
                        fn: function (e) {
                          var selected= $(e.target).val(); //Get the type of cooperation id
                          var newvalues = FunctionToGetTheSecondDropDownValues(mtype).split(";"); // split the lines
                          var DropDowncontructor= "";

                          if (newvalues!= "") {
                            for (var i = 0; i < tcoops.newvalues; i++) {
                              var newvalues= newvalues[i].split(":");
                              DropDowncontructor+= '<option value="' + newvalues[0] + '">' + newvalues[1] + '</option>'  // the is the value and the ID

                            }
                          }

                          $("#unit").html(DropDowncontructor);
                        }
                      }]
                },

This is not tested ... not 100% correct, but is very near that (maybe 95%).

Best regards,

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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