7 Answers, 1 is accepted
The problem comes from the fact that products datasource is not observed correctly in this case correctly. You will need to call the ObservableObject init method in order to resolve this issue. Check the updated demo:
This is great, but how can I add some fields to viewModel?
This is not working:
the object you are passing a parameter in the constructor of the viewmodel instance should be handled in the init method of the observable object descendant - right now it its fields are not assigned anywhere in order to be subsequently bound to.
I would also like to ask you to use your newly created support account
admin@d****.eu with the transferred license, as the current one no longer has an associated active support.
but then field1 is not recognized by MVVM.
this approach won't work for sure. Please check my previous reply - you need to assign the fields from the received parameter to your own object.Regards,
Last question. Would this be ok?
Or it would be better to avoid that and just init fields in init method?
$.extend(this, options) does pretty much what it says. It may do the trick for your case.Regards,