Open ncote opened 10 years ago
The model does publish changes to listeners registered through controller.on. there's not yet a way to refresh the data going into the treed instance, however.
I'm actually adding first class support for a data store layer, so you can add a restful backend (or any other kind).
What are you thinking of using it for? On May 15, 2014 5:53 AM, "ncote" notifications@github.com wrote:
Hi there,
Great tree, love the keyboard action.
I'd like to implement two-way binding using my own data model. Is there a way to subscribe to changes to the tree's internal model? And will the view react if we mutate the model directly? I see the Controller::on function looks like it might be related to this, but am not too sure how to use it.
— Reply to this email directly or view it on GitHubhttps://github.com/jaredly/treed/issues/11 .
Thanks for the quick response.
I was trying to two-way bind it to a Knockout model. My app uses Knockout throughout, so I thought it would be nice to subscribe to tree changes to update my Knockout model; and also pass in my Knockout model changes to the tree.
My model can be edited through multiple views, all visible simultaneously, and I'd like to keep everything nicely synched and not have to worry about restoring state. That being said, if I could figure out the current state of the tree (selected node, editing or not, opened/closed branches) I might just rebuild the entire tree and restore the state when changes happen in another view.
More directly related to Controller.on though: listeners are eventually called without any arguments, so I'm not too too sure how to determine what has changed.
/nc
Very nice work!
I want the component to be able to fetch and save the json-tree from/to node/express server.
Any suggestions is welcomed!
Hi there,
Great tree, love the keyboard action.
I'd like to implement two-way binding using my own data model. Is there a way to subscribe to changes to the tree's internal model? And will the view react if we mutate the model directly? I see the Controller::on function looks like it might be related to this, but am not too sure how to use it.