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
1329
UltraWebGrid with DropDownList / ValueList column
posted

I have a bound Hierarchical UltraWebGrid and one of the columns is a DropDownList / ValueList with values (Read, Write, Execute). When I change the vale of the parent column DropDownList, I would like to set each child's DropDownList column to be the same selectedValue as the parent. For example, if select "Execute" from the parents DropDownList, I need to loop through each of that parents child rows on the client side and set the selectedValue = "Execute" as well. Right now I am working with the ValueListSelChangeHandler but can use a hand here. Thanks!

Parents
No Data
Reply
  • 1329
    Verified Answer
    posted

    I came up with this solution on my own but I am looking for something a bit more robust...   

     function valueListSelChangeHandler(gridID, valueListID, cellID)
         {
             var valueList = document.getElementById(valueListID);
             var parentRow = igtbl_getRowById(cellID);
             var cell = igtbl_getCellById(cellID);
             var children = cell.Row.getChildRows();
             var newValue;
            
             if (valueList.selectedIndex == 0){
                newValue = 'Read';
             }
             else if (valueList.selectedIndex == 1){
                newValue = 'Write';
             }
             else if (valueList.selectedIndex == 2){
                newValue = 'Execute';
             }
            
             if (children.length > 0) {
                for (var i = 0; i < children.length; i++){
                    var row = parentRow.getChildRow(i);
                    var oldValue = row.getCell(1).getValue();

                    if (oldValue != null){
                        row.getCell(1).setValue(newValue);
                    }   
                }
             }
         }

Children