1

I am using 'ui-grid/dropdownEditor' for one of my column and I want to dynamically load the drop down options which is unique for each row. I want to load the drop down options dynamically on demand via async http call.

I tried the following without success,

$scope.gridOptions = {
columnDefs: [
     { field: 'priority',
displayName: 'Priority',
editableCellTemplate: 'ui-grid/dropdownEditor',
editDropdownIdLabel: 'id',
editDropdownValueLabel: 'name',
    },
]}

onRegisterApi: function(gridApi) {
        gridApi.edit.on.beginCellEdit($scope, function(rowEntity, colDef) {
            if (colDef.field === "priority") {
                localServices.getPriorityById(rowEntity.id).then(function(data) {
                     colDef.editDropdownOptionsArray = data;
                });
            }
        });

Any suggestion or help to achieve this is appreciated.

1 Answer 1

2

You should look into the usage of editDropdownRowEntityOptionsArrayPath instead of editDropdownOptionsArray

editDropdownRowEntityOptionsArrayPath can be used as an alternative to editDropdownOptionsArray when the contents of the dropdown depend on the entity backing the row.

Here is a link to tutorial

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.