Highlighted

Calling 1 View in another View in SCF -Model/View is not initialized.

pallavis8124480

24-10-2019

How can we call from 1 view to another in Social community framework ?


We have a use case in our project where we have 2 views :
i) View1 which extends Journal
ii)View2 which extends Topic View

There is a button present in View2 with some functionality .The current requirement is to expose the same button with same functionality in View1.

Our idea was to leverage the same button  in View1 with all its function calls.But we faced issue because View1 is unknown to the methods used in View2. We got exceptions such as "Method not found" when we tried to call someMethod() of View2.

Reason : The current View/Model which loads is of View 1 but not View2 so obviously ,the methods wont be present.

By digging some code we tried to call the method of view by using :
SCF.View2.prototype.someMethod()

Now the method was executed ,but we are still facing issue because the current object(this) refers to View1 instead of View2.

The problem is View 2 model/View is not initialized.

Is there a way to call View 2 in View with Model/View object initialized.


Please let us know.
Thanks in Advance !