canlist.extend({
foo:() => {
// `this` is the window
},
bar() {
// `this` is the List instance
}
})
.stache
file use {{#with}}
and access/edit the object properties?
new Map()
is not what you want, but just new Person()
, right?
get
, it would only run again if something observable changed, but there’s nothing observable in that function.
orderBy: {
value: "name"
},
playersPromise: {
get: function(){
return Player.getList({orderBy: this.orderBy});
}
}
if
condition is met):
type: function(newPerson) {
if (newPerson && newPerson instanceof Person === false) {
console.log('>>> debug data 1:', newPerson);
return new Person(newPerson);
}
return newPerson;
}
newPerson
is the value of the input field, so it will never have any valid data again (as it is just one plain value)
newPerson
would at least be an object but only the currently selected input value is passed as newPerson
return new Person(newPerson)
code
newPerson
contains whatever you wrote on one of the inputs
How do you handle a bulk save or destroy?
I have something like this: let todos = TodoModel.getList()
and every todo has a checkbox and are stored in a selection DefineList
.
Now I want to delete the selected todo items.
selection.forEach(todo => {
todo.destroy();
});
This results in multiple requests to the backend, how can I group these request?
Do I make a custom funtion in my model bulkDestroy
and then splice them out of my todos list? Or how do you handle this?