How to pass an object while routing to new view in SAPUI5 - sapui5

In my application, I am opening a new page in a new tab when the user clicked on a button. This new page displays the data which it received from the previous page. I am able to retain the object data by setting the JSON model to the UI core or view if I use navTo() and don't load the view in a new tab. But, when I try to open the view in a new tab the model is getting destroyed.
Please, let me know if this can be achieved in UI5 and how.
Thanks in advance.
Venkatesh.

Related

How to pass values to a new open(created) window (dialog, panel, page etc) with MVVM in Blazor

I have "PageMain" with "PageMainViewModel" binded, there is a "Edit" button in "PageMain", What is the best practice in MVVM for Blazor to pass the values(example:ProductInfo) to the new opened edit form window ("EditFormWindow") when the "Edit" button is clicked?
I used to use the massagers to communicate between each viewmodel, but in this case, the "EditFormWindow" is new opened, Even I added a register of messager in the constructor of "EditFormWindowViewModel", when sending message (passing data) from "PageMainViewModel", the "EditFormWindowViewModel" is not initialized yet so "EditFormWindowViewModel" cannot receive the message(passed data) from "EditFormWindow".
What I am doing now is to pass the values from View (Balzor file) to Viewmodel, but I am wondering if there is a better solution that I don't have to write any codes in View(Blazor file).

in YII2 how to post data using modal dialog?

I'm using modal dialog. I'm working with two modal. User Model and STATE Model where
User is Parent model and state/create is open in modal dialog.
when I'm creating new User, I have select state name from drop-down, if it is not listed in dd then it will create state by clicking add new state and open in modal dialog and create state.
Issue is after create new state parent page is refresh and all the data which I have added are removed.
Kindly guide me. I have created modal dialog by below link
Not sure if I understand your problem correctly because there is no example code. But if you have separate form to add new state then you can submit that form with ajax using beforeSubmitevent of ActiveForm.
An example of beforeSubmitevent implementation you can find in this issue
Also in your controller action you will have to set response type to json like following
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
More info on response types.

Best way to update view from command or filedialog in an eclipse rcp application

In my application I have a menu which open a SelectionDialog, this dialog is used to choose an object.
When this object is selected I have to display it in the view.
What is the best way to update my view?
Currently, I call myview.update(object) after the dialog is closed (in the handler of the menu). But I think this solution is not well design.
I have read about update my model and notify my view but my model does not change (no data are changed, I only display different Data ).
Does anyone has some ideas for a well design solution ?
Define model listener ( dataPopulated(Event e))
Make your view implement model listener and register it with the Model.
Define a Model class that can contain the objects that you want to populate in the view
When Model.setInput(Object input) is invoked fire dataPopulated() event on all registered model listeners.
Above steps works properly when you have view activated. You need to consider cases like when if view is deactivated or not visible ( make sure you refresh view is visible else you will have unnecessary overhead of refreshing view though it is notvisible)
Try adding a selection listener in the view and register this selection in the dialog.
In the listener action, add the code to show the selected object.

Updating a view from a command handler

I have a file dialogue opening from the menu where a user can select a file. The FileDialog is called from the menu command's handler class in execute().
Based on the file the user selected, I would like to update a view, for which (I believe) I'd need the same Composite element that's passed to the view in createPartControl().
Is it possible to get access to it from the command handler, or would it be better to trigger the view updating via something like ISourceProviderListener or PropertyChangeListener?
Thank you.
Yes, it's possible:
IViewPart part = HandlerUtil.getActiveWorkbenchWindow(executionEvent).getActivePage()
.findView(viewId);
It would be better to first update the data that your view is displaying (the model in MVC) and the change in data should trigger view refresh. It's hard to say which listener is better without knowing all the details.

Saving page preference in site navigation using SiteMapPath control

I have created site navigation in my ASP.net application using SiteMapPath control and its working fine. Now my requirement is that, there is open page in my application which has Radio buttons and based on their selection datagrid is populated from database. I want to save the radio button selection in navigation url so that when I click on that page through navigation url then page will display the data from my selected options.
Any help would be highly appriciated.
Thanks,
Yogesh
I'm not sure that I understand. I propose some other solution (using Session). Add event to radioButton onSelectionChange. When selection change, remember this in Session
Session["name_param"] = some_params;
And in form with dataGrid get event PageLoad with code:
if ( Session["name_param"] != null ) {
var param = Session["name_param"];
// using param to load data to grid
} else {
// something else, maybe default chance for data to grid
}