Hi Team,
I have a column(Template data field - item template - web drop down) in web data grid.
I want to get selected row when we select an item in web dropdown from client side.
Added below code to web drop down in template data field.
ClientEvents SelectionChanged="ddl_SelectionChanged
function ddl_SelectionChanged(sender, eventArgs) { var grid = $find("<%= gvParams.ClientID %>"); var rows = grid.get_rows(); alert("rows" + rows.get_length()); var rowSelected = grid.get_behaviors().get_selection().get_selectedRows(); alert("selected" + rowSelected); //grid.Rows.refresh(); }in the above method i am getting null value in rowSelected variable.I want to get the selected value in drop down and selected row index.Please do the needful
Regards,
Sravani
Hello chinni nani ,
Thank you for posting in our forum.
I’ve looked into this and it seems that in this scenario the WebDropDown will take the focus from the grid so the active cell and the selected row will not be changed when you open the drop down.
If you had selected another row before you open the drop down then that’s the row the will be returned inside the selectedRows on the client side.
If you want to get the row the drop down belongs to you could get it from the parent dom elements since each WebDropDown in this case will be nested in a cell. So for example:
function dd_SelectionChanged(sender, e) {
var parentRow = sender.get_element().parentElement.parentElement._object.get_index();
var selectedRowIndex= sender.get_element().parentElement.parentElement._object.get_index()
alert(selectedRowIndex);
}
This would get the row element which is the second parent of the WebDropDown (the first is the cell). From it it gets the row object and displays an alert with the row index.
Let me know if you're trying to achieve something similar.
Best Regards,
Maya Kirova
Developer Support Engineer II
Infragistics, Inc.
http://ko.infragistics.com/support
Hi Maya,
I have the same question. Can we get parent row index of the drop down provider in the WebDataGrid? I don't want to enable selection on the grid just for this purpose.
And no. Your solution doesn't work. Did you actually try it out before posting?
I would appreciate quick response.