Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
175
Web data grid selected row in client side (Grid has webdropdown as a column)
posted

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

Parents
No Data
Reply
  • 29417
    Verified Answer
    Offline posted

    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://es.infragistics.com/support

     

Children