I have created a sample jsfiddle at http://jsfiddle.net/nair/bv3FG/19/ to demonstrate the problem I am running into. I have a collection of person, I show them in a table, with an option to edit each row. The data display properly on load. But when I go to edit model I face two problems;
- I need to make sure when I edit a row, I want the edit template to
show but not the table. I am using visibility to toggle visibility.
This does seem to work. - When I press edit, the form shows to edit but my selected item data
does not show, even though in the template I am passing, the
selected item as the data.
Thanks,
The issue is that it errors out trying to bind immediately against your selecteditem which is an empty array.
A better strategy is probably to use the
withbinding againstselecteditemto control the context of that section. Ifselecteditemis empty, then that area will not be rendered.So, it would look like: http://jsfiddle.net/rniemeyer/ACE2d/
Then, you don’t need to use visibility on your form, as the
withbinding will take care of it. After saving, you can mark the item as null and the area will no longer be visible/bound.