Open hieutt2-ssi opened 1 year ago
The factory function receives the tabnode object, so you can do node.getConfig() and pass that to the component
Hi nealus,
Looks like I haven't fully expressed my intentions. I will make a example.
My layout has 3 components IndexChart , MatchedPrice , MarketDepthPrice
{
"type": "tab",
"id": "#f826f71d-59ed-4931-9691-f6f0ef18baa2",
"name": "Index Chart",
"component": "indexChart",
"config": {
"indexValue": "HNXIndex"
}
}
{
"type": "tab",
"id": "#1a3e6176-6118-43e5-ab87-9e506919b2cd",
"name": "Matched Price",
"component": "matchedPrice",
"config": {
"stockNo": "hose:3853",
"symbol": "VND"
}
}
{
"type": "tab",
"id": "#1e4f92c7-62c4-45a0-a0ac-add1b9289d20",
"name": "marketDepthPrice",
"component": "marketDepthPrice",
"config": {
"stockNo": "hose:1543",
"symbol": "HAG"
}
}
Inside the IndexChart component, I can get the config using node.getConfig().
config = {"indexValue": "HNXIndex"}
But I also want to get the config of MatchedPrice and MarketDepthPrice components in IndexChart component.
(Components and configs are subject to change)
Best regards.
you can use node.getModel().visitNodes() to visit all the nodes in the layout tree and hence gather their config.
Also if you gave those nodes unique ids (rather than the auto generated ones) then you could access them using node.getModel().getNodeById(
https://rawgit.com/caplin/FlexLayout/demos/demos/v0.7/typedoc/classes/Model.html#visitNodes https://rawgit.com/caplin/FlexLayout/demos/demos/v0.7/typedoc/classes/Model.html#getNodeById
My problem: In each component, every time I perform an action I save my data in that node's config using
Question: After reloading the previously saved json, how can I retrieve all the config while I'm in a certain component?
My json: