ion-nav-back-button not firing state controller - angular-ui-router

So, I am using ui-router for my app's routing. There is a scenario, I clicked like button on the item detail page. Then I hit back button, it goes back to the main page, it is a list of items. The item has a likes counter. But I found the counter did not increase because back button did not fire the controller for main page.
I want to understand how can I fire the controller while clicking back button.

You should isolate your data in a provider to manage the data sync between your views. If all of the data is contained in a service, you can update it from one view, and it will always be synced with the other.
In both of the controllers, require 'ItemRepository' which will provide the data to the views.

Related

How to pass data from one page model to another page model in fresh mvmm

I have used Fresh MVMM. I need to pass a data from one page model to another page model without using init and reverse init.
Eg: I have one toggle button in first content page.
I need to toggled the button based on the selection in second popup page without popup the second PopPopupPageModel.
ReverseInit is worked when popup the second PopPopupPageModel and can easily pass data.
But I need to toogled the button in first page without popup the second page.
Please help...

extjs Save component view state before removing it from parent component

Let me explain the my scenario. I am using ExtJS5. I have got a view component (let us name is viewOne) contain two combo boxes, button search and some action button, on click of search button the grid is populated. This viewOne is in a parent view component (viewParent). I need to load a second view (viewTwo) on selecting some grid row and clicking some action button a new view is loaded (viewTwo) in the parentView. When I come back from viewTwo to viewOne I need old values of combo boxes to re perform the search.
Currently I am storing the values of combo boxes in a store and set then when the after view render and call search. We have discarded card layout for this implementation.
I wanted to know how this can be done via Ext.state , I cannot find any example on the same that is close solution to my problem. Any other way of doing this ?
State seems reasonable for that. First of all you must set StateProvider (by calling Ext.state.Manager.setProvider) to instance of class which extends Ext.state.Provider.
Then state should work for you. Only thing that you must remember is to set stateful property to true and set stateId of the component.
Usually you don't need to save state by yourself. All built-in stateful components have defined state events. When such state event occur (eg. expand on panel) then state is saved automatically. You can customize state events by calling addStateEvents in initComponent.
To provide custom component state you should override applyState and getState methods. When you combine it with addStateEvents you have all what you need.
Example: http://jsfiddle.net/48jw81da/16/

MVC3 Navigation, browser positionin g

I have a C#.NET MVC3 web app. I have a View that has a List of Models. This list can be long, requiring the user to scroll down on the View. When selecting one of the models in the View to Edit, the user is taken to the Edit View. After submitting the Edit View, the user is redirected back to the List View. However, the List View is now displaying back at the top of the list. How can I redirect the user back to the same position in the List View where they clicked the Edit button?
You would probably be better suited using a modal popup dialog to edit the data, rather than navigating to another page.
While it's possible to do what you want, it's a pain. You would have to get the scroll location via javascript, save it to a hidden field, post that to your edit page, along with record number and anything else, then re-post it back to your original page when you return, then read the post value and scroll to it via javascript.
All that is avoided if you just use a modal edit dialog, then when the dialog goes away the page is still in the same place.

Notifying other page database item has changed, best practice for MVVM WP7.5?

First of all, I'm using MVVM for this and I would like to continue using it and ofc using the best practices as well.
I have a Mainpage which will display a list of items. On another page you can add such items. The items will be saved in a database which came with the Mango update.
When a item is added I want to navigate back to the mainpage and I want the list to be updated automatically. Is this possible and what's the best way? I'm thinking of following scenario's:
Use the Refresh query string when you navigate. Check in the back end of your main if there is a refresh. Then send a message 2 the ViewModel that he needs to update his list. I have tried this and this works. But this doesn't really sound the right way for MVVM.
Can't this be done with the NotifyPropertyChanged event that you can raise on your Database Model ? Or doesn't it work over different pages?
Reload the whole ViewModel for the main page somehow.
Any other idea's?
Use MVVM-Lights Messenger. The MainViewMode can subscribe to a Refresh event and the ViewModel where the items are added can publish a Refresh event.
This is a good example of how messenger can be used.

get and display data in MVC 3 using Ajax

I have one view page in MVC named as ‘Index’. There are 3 main controls in that view page. For better understanding, take below example as reference.
1. One Dropdown ‘Customer’
2. One Dropdown ‘Project’ (that depends on ‘Customer’)
3. List of Task (that depends on ‘Project’).
Currently first user needs to select ‘Customer’. So based on customer ‘Project’ dropdown data will be fetched from post method of Index and bind that ‘Project’ dropdown. After selecting ‘Project’, List of task will be fetch from post method of Index and bind those tasks. So every time page is loaded again.I want to do it by Ajax form submit.
My problem – those 3 controls are in one view page so I want to return page view using Ajax without using Partial View. Is this possible? If yes then how? Or any other solution so that I am able to display data without reload whole page again.
If u can give me example of such scenario then it will be good.

Resources