I want to create a widget where I can click on expanded button on the view and it leads to other view where I can see the TabPanel and clicking on the tabs give the information into the GridView under the TabPanelView. I created a widget using ‘yo’ command extension, it created the default “Hello” Widget. View, Model, ModelFactory are working fine in the widget. I can get the model data on the view using the fetch method.
Then, I have implemented ExpandingBehavior in the main view by following the CSUI-SDK document. For Expanded View, I have created new Marionette.ItemView.
Into the ExpandedView, I tried to fetch model data using the factory model and get the data into the expanded view same way as Main view fetches the data. For fetching the model data:
constructor: function ExpandView(options) {
options.model = options.context.getModel(ModelFactory);
Marionette.LayoutView.prototype.constructor.call(this, options);
this.listenTo(this.model, 'change', this.render);
},
Expanded view is trying to fetch same model which used by main widget view. Also, I have reviewed the “Workflow Status” Widget under “csui-sdk-16.2.8\lib\src\workflow\widgets\wfstatus”. I have changed the Main View and Expanded view (Marionette.ItemView) to “Marionette.LayoutView”. Also, I have found that “options.model=options.context.getModel(ModelFactory);” line is executed into the template helper function in the “wfstatus.extended.view.js” (csui-sdk-16.2.8\lib\src\workflow\widgets\wfstatus\impl). I have also tried to implement that as well. In both scenarios, I have found error.
“options.model=options.context.getModel(ModelFactory);” –is this function executed in constructor, it gives “Uncaught TypeError: Cannot read property 'context' of undefined” error.
templateHelpers: function () {
var model = this.options.context.getModel(ModelFactory);
},
“options.model=options.context.getModel(ModelFactory);” –is this function executed in Template helper function, it gives “Uncaught TypeError: Cannot read property 'context' of undefined”.
Also, won’t able to open the expanded view after clicking on Expanding button the widget. If I remove the “this.options.context.getModel(ModelFactory);”. Then, I can see the ExpandedView. It will show the expanded view and its simple template without any model data.
Questions:
- Does “Expanded view” is behave like a child view?
- Does expanded view is required different model and factory?
- How is the “options” and “context” defined?
- What is difference in executing the [options.context.getModel(ModelFactory)] in constructor and template helper?
- What can I do to solve the Issue?
- If I will create TabPanelView and GridView into the LayoutView, how can I manage the rendering of model data?