I believe the title & my simplified jsFiddle Example explains my predicament.
Basically I am dealing with an extremely large & multidimensional observer object containing folders & files, all of which have dynamic property names.
When it comes to using the Observer setProperty()
function, I am struggling to find a way to use this on properties with a dot in the name such as "file.png". This is obviously because when the full stop appears in the set property path JSViews believes it to be a step deeper in the object tree.
Aka:
path.fileWithoutExt.attrs
= Works.
path.fileWithExt.png.attrs
= Fails.
So my question is "Is there a way to achieve property setting, or is it not possible or a feature request?" Could it be something like:
root.path.[file.dot].more
or:
root.path.{{file.dot}}.more
You can't pass in paths like
"object['keyName'].foo"
as first parameter ofsetProperty
. (That parameter does expect simply dot-separated paths).But you don't need to. Just pass the actual object to
$.views.observable(...)
then you only need to pass the leaf property name tosetProperty
:Updated jsfiddle: all three work...
path["fileWithExt.png"].attrs
= Works.