tweaked example components setter-getter
Pass the function, not the returned object, to the autocompleter component. Allows `dashboard` to pass results from `m.request()` - Tested OK
This commit is contained in:
parent
e8af4fd7b5
commit
46e8ffc627
1 changed files with 2 additions and 2 deletions
|
|
@ -99,7 +99,7 @@ autocompleter.controller = function(data, getter) {
|
|||
this.change = function(value) {
|
||||
this.value(value);
|
||||
|
||||
var list = value === "" ? [] : data.filter(function(item) {
|
||||
var list = value === "" ? [] : data().filter(function(item) {
|
||||
return this.getter(item).toLowerCase().indexOf(value.toLowerCase()) > -1;
|
||||
}, this);
|
||||
this.data(list);
|
||||
|
|
@ -130,7 +130,7 @@ var dashboard = {}
|
|||
|
||||
dashboard.controller = function() {
|
||||
this.names = m.prop([{id: 1, name: "John"}, {id: 2, name: "Bob"}, {id: 2, name: "Mary"}]);
|
||||
this.autocompleter = new autocompleter.controller(this.names(), function(item) {
|
||||
this.autocompleter = new autocompleter.controller(this.names, function(item) {
|
||||
return item.name;
|
||||
});
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue