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
10240
Update WDD WebDropDown editor based on value of another WebDropdown editor
posted

Hello,

Based on the selection of "state" a hidden field updates that drives the cities that will populate another dropdown editor provider. The problem is that the cities in the dropdown are "all" the cities, not the cities for the selected state. The hidden field is being updated in the RowAdding_ExitedEditMode event
Parents
No Data
Reply
  • 10240
    posted

    Hello,

    What I propose is to use the cascading WebDropDown approach. By this the dependent WebDropDown editor would display a filtered item list based on the selected value of the 'independent' WebDropDownEditor.

    This approach really wouldn't need to utilize the hidden field as you have presently implemented

    To accomplish this you need to handle two important events: (1) SelectionChanged (2) ItemsRequested

    In the SelectionChanged event the load items method is called (which calls to and fires the ItemsRequested server side event) based on when a selection has changed in dropdown. So the ItemsRequested server event will fire and populate the "2nd dropdown" based when the selectionchanged event fires which calls the load items method:


    function DropDownProviderDepartment_SelectionChanged(sender, args) {


    var grid = $find("");


    var clientID = grid._editorProviders._items[1]._editor;


    if (grid.get_behaviors().get_editingCore() != null) {


     


    var rowadding = grid.get_behaviors().get_editingCore().get_behaviors().get_rowAdding();


    var editBehavior = grid.get_behaviors().get_editingCore().get_behaviors().get_cellEditing();


    if (editBehavior.get_cellInEditMode() != null) {


    var nextCell = editBehavior.get_cellInEditMode().get_row().get_cell(editBehavior.get_cellInEditMode().get_index() + 1);


    editBehavior.enterEditMode(nextCell);


    var val = args.getNewSelection()[0].get_value();


    clientID.loadItems(val);


    flag = true;


    }


     


    else {


    if (rowadding.get_cellInEditMode() != null) {


    var nextCell = rowadding.get_cellInEditMode().get_row().get_cell(rowadding.get_cellInEditMode().get_index() + 1);


    rowadding.enterEditMode(nextCell);


    var val = args.getNewSelection()[0].get_value();


    clientID.loadItems(val);


    flag = true;


    }


    }


    }


    }




     

Children