1

How to catch dropdown selection changes in ui-grid. I've customised 'ui-grid/dropdownEditor' like this

var customCellTemplate = '<div><form name=\"inputForm\"><select ng-class="\'colt\' + col.uid" ui-grid-edit-dropdown ng-model=\"MODEL_COL_FIELD\" ng-change="vm.onDropdownChange(row)" ng-options=\"field[editDropdownIdLabel] as field[editDropdownValueLabel] CUSTOM_FILTERS for field in editDropdownOptionsArray\"></select></form></div>'

Added ng-change="vm.onDropdownChange(row)" in ui-grid/dropdownEditor but onDropdownChange event not fired.

And my controller looks like this

function Controller(){
    vm.onDropdownChange = onDropdownChange;        

    vm.gridOption.columnDefs = [
        {
            field: 'staus', displayName: 'Status', editableCellTemplate: customCellTemplate, width: '20%',
            cellFilter: status filter, editDropdownIdLabel: 'status_id', editDropdownValueLabel: 'status', editDropdownOptionsArray: statusArray
        }, 
        {
          //Other fileds
        }];

    function onDropdownChange(row){

    }
}

Please tell me where i'm going wrong and how to accomplish this functionality.

1 Answer 1

2

You need to use appScope to trigger your function.

Have a look here

grid.appScope.onDropdownChange();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.