use autocomplete in filter form
This commit is contained in:
parent
bfb1f95bd5
commit
475a784da5
1 changed files with 19 additions and 0 deletions
|
@ -29,6 +29,7 @@ pandora.ui.filterForm = function(options) {
|
||||||
if (key.format && key.format.type == 'ColorPercent') {
|
if (key.format && key.format.type == 'ColorPercent') {
|
||||||
key.format.type = 'percent';
|
key.format.type = 'percent';
|
||||||
}
|
}
|
||||||
|
key.autocomplete = autocompleteFunction(key)
|
||||||
return key;
|
return key;
|
||||||
}).concat([{
|
}).concat([{
|
||||||
id: 'list',
|
id: 'list',
|
||||||
|
@ -70,6 +71,24 @@ pandora.ui.filterForm = function(options) {
|
||||||
that.getList = that.$filter.getList;
|
that.getList = that.$filter.getList;
|
||||||
that.value = that.$filter.value;
|
that.value = that.$filter.value;
|
||||||
});
|
});
|
||||||
|
function autocompleteFunction(key) {
|
||||||
|
return key.autocomplete ? function(value, callback) {
|
||||||
|
pandora.api.autocomplete({
|
||||||
|
key: key.id,
|
||||||
|
query: {
|
||||||
|
conditions: [],
|
||||||
|
operator: '&'
|
||||||
|
},
|
||||||
|
range: [0, 100],
|
||||||
|
sort: key.autocompleteSort,
|
||||||
|
value: value
|
||||||
|
}, function(result) {
|
||||||
|
callback(result.data.items.map(function(item) {
|
||||||
|
return Ox.decodeHTMLEntities(item);
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
} : null;
|
||||||
|
}
|
||||||
that.updateResults = function() {
|
that.updateResults = function() {
|
||||||
if (mode == 'list') {
|
if (mode == 'list') {
|
||||||
Ox.Request.clearCache(list.id);
|
Ox.Request.clearCache(list.id);
|
||||||
|
|
Loading…
Reference in a new issue