I am not sure, if I ask the question properly, so I try to explain the scenario. I have the feeling that I miss something simple in handling knockout.
I read (and later write to) multiple xml files. These files have some entries that are equal and some entries that differs:
<elements>
<id>123</id>
<unknown>some text</unknown>
</elements>
After reading the xml files I come up with an observableArray which I can access as mentioned in most tutorials without any problem.
So in this example I have no problem to read and edit the "id", cause I know that it calls "id":
<span data-bind="text: $data.id"></span>
But there are entries in the xml that i dont know, but they are in the observableArray and I can "see" that, if I refer to $data:
<pre data-bind="text: ko.toJSON($data, null, 2)"></pre>
This shows me the unknown parts:
...
{
"unknown": "some text"
}
...
To edit this property I had to access them by name or is there another option? So my problem is to access this for example via:
<input data-bind="value: $data.???" />
If more information is required, please let me know.
Thanks for ideas and answers.
The html-markup:
The Javascript Code:
The JsonObject which I correspond to (chrome view):
and the result in the browser:
edit: A nice way is using a custom binding-handler: