When user clicks row I want to display data in inputs so it is editable (don’t want editing in table)
Here is the code:
http://jsfiddle.net/APzK8/
Like you can see two inputs work and two don’t. I’d prefer to have only Selected property in ViewModel. In real code every Config will have 15-20 properties.
Also if you could help me selecting first Config on page load. I can click the row with javascript but it is ugly. I think it should be defined in viewmodel. Tried many things but nothing worked.
Basically, you would need to access the values by doing
Selected().Namerather thanSelected.Name. So, you want to get the underlying value of selected and then access itsNameproperty.However, an easier/better way to do this is to use the
withcontrol-flow binding, which will protect you against null values (avoid having to writeSelected() ? Selected().Name : nullkind of statements).It would look like:
Here is a sample: http://jsfiddle.net/rniemeyer/APzK8/2/
To select the first config, I just initialized
Selectedto the first value inConfigs.