Hello
I am doing the tutorial "Working with Lists and Collections".
1.) What does javascript internally "do", that the whole row is deleted?
I think it is because on using "$root". So where exactly is $root pointing to?
1) Does $root.removeSeat point to an seat/element in the array?
2) Removes the item in the array
3) And because it is an observable the view of the array is updated and the row therewith deleted?
<tbody data-bind="foreach: seats">tr>
<td><input data-bind="value: name" /></td>
<td><select data-bind="options: $root.availableMeals, value: meal, optionsText: 'mealName'"></select></td>
<td data-bind="text: formattedPrice"></td>
<td><a href="#" data-bind="click: $root.removeSeat">Remove</a></td>
</tr>
...
In ViewModel:
self.removeSeat = function(seat) { self.seats.remove(seat) }
Thanks, Meru