x-Editable Dropdown

by Farzad Cyrus

JavaScript

api.getAssetTypes(data.id).then(function (assetTypeData) {

            var assetTypes = _.map(assetTypeData, function (a) {
                return { id: a.id, text: a.name }
            });

            $assetType.editable({
                type: 'select2',
                pk: 1,
                autotext: 'always',
                value: data.assetTypeId.toString(),
                source: assetTypes,
                select2: {
                    id: function (item) {
                        return item.id;
                    },
                    allowClear: true
                }
            });
        });