SMART datagrid v.1 > Classes > ListCellEditor

Back  Forward

DataLudi.ListCellEditor.itemsCallback  property

Callback function which returns list items. 

function (index: CellIndex): { values: [], labels: [] };

It is used when dynamically organizing list items for data cell state during run time. If specify this property, all settings related to list item as values will be ignored. 

As the definition of callback function above, it should return JSON object in which contains values and labels arrays. labels does not have to be contained in it. 

Getter
function itemsCallback(): Function
Setter
function setItemsCallback(value: Function)
Code -1
    var columns = [{
        name: "colCode",
        editor: {
            type: "list",
            itemsCallback: function (index) {
                var items = { values: [], labels: [] };
                if (index.getRow().getValue('flow') == 'Import') {
                    items.values.push('500001', '500002', '500003', '500004', '500005');
                    items.labels.push('import 1', 'import 2', 'import 3', 'import 4', 'import 5');
                } else {
                    items.values.push('900001', '900002', '900003', '900004', '900005');
                    items.labels.push('export 1', 'export 2', 'export 3', 'export 4', 'export 5');
                }
                return items;
            }
        }
    },
    ...
See Also
values
labels
domainOnly
Examples
List Editor Styles