This is a migrated thread and some comments may be shown as answers.

[Solved] How to access grid data from onChange event of DropDownList

2 Answers 143 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Bruce
Top achievements
Rank 1
Bruce asked on 20 Apr 2012, 03:08 PM

Hi
I have an MVC grid, actually master detail grid, which works.

The detail grid contains 3 cols, the third of which is a DropDownList, which works.

I intended to use the onChange event of the DropDownList to access the current rows data.

However I just can’t seem to get it.

I’m stuck, can anyone please provide some guidance ?

2 Answers, 1 is accepted

Sort by
0
Pechka
Top achievements
Rank 1
answered on 21 Apr 2012, 07:03 AM
Yo,

Show some code and how you try to bind to that event.
0
Bruce
Top achievements
Rank 1
answered on 23 Apr 2012, 10:51 AM
I have managed to find a solution, unsure if its the best.
The initial aim was get get the selected text from the dropDownList.
The dropDownList has onChange event attached as follows:
   
.ClientEvents(events => events.OnChange("dropList_onChange"))<br>


function dropList_onChange(e) {
            /* Get the dropList */
            var dropList = $(this).data('tDropDownList');
            /* Get the current row */
            var currEditRow = $(this).closest(".t-grid-edit-row");
            /* Get the dataItem for the closest .t-grid */
            var parentDataItem2 = currEditRow.closest('.t-grid').data('tGrid').dataItem(currEditRow);
            /* Assign dropList test to a property of the current row */
            parentDataItem2.proficiency_sa_name = dropList.text();
}



Tags
Grid
Asked by
Bruce
Top achievements
Rank 1
Answers by
Pechka
Top achievements
Rank 1
Bruce
Top achievements
Rank 1
Share this question
or