Open taxigy opened 8 years ago
Yep, this is already mentioned in #95 and also I'd like to add AutoForm support at some point (#9, #91).
Maybe you can write a PR?
I think we should keep this package lightweight...
Here what i did if you need to create new item if no-match found:
on submit event
var i = t.find('input').value // retrieve input value from autocomplete input box
console.log(i); // return user's input value
var c = C.find({}, { // fetch array of collection
fields: {title:1, src:1, sC:1, _id:0},
transform: null
}).fetch();
console.log(c);
var a = _.filter(c, _.matches({'title':i})); // filter c to only retrieve matched object
console.log(a); // return array of matched objects
if (_.isEmpty(a)) { // if a is empty (no-match) then insert i into collection C. The newly created documents will show at auto suggestion after submit event. there is no 'no-match' again after this
return C.insert
} else { // if a not empty then add i into list
_.forEach(a, function(x) {
// Code adding i into collection list. List.insert...
});
}
thankYou...
Let's say I have a simple collection:
And I want to let app users add new items into this collection either in
insert
orupdate
AutoForm. In current state, it seems not possible, and values that don't match are just ignored.