Refresh list in view

13 views
Skip to first unread message

Rick

unread,
Aug 19, 2011, 4:57:14 PM8/19/11
to magellan-friends
I'm using Magellan succesfully for a wizard-style application where
the navigation make perfect sense, but now I've got a screen that the
user is going to stay on for an extended period of time and I need a
way to 'refresh' the data in a list.

In an ASP.NET MVC app I'd simply make a Ajax call to the controller.
Would I use a similar concept with Magellan?

Rick...

Paul Stovell

unread,
Aug 19, 2011, 5:06:16 PM8/19/11
to magellan...@googlegroups.com
Very similar.

Your view model would look like this:

private void RefreshList()
{
    Navigator.Navigate<MyController>(c => c.Refresh(this));
}

The controller would have an action like this:

ActionResult Refresh(MyViewModel model)
{
    model.Customers.Clear();
    model.Customers.AddRange(GetCustomers());
    return DoNothing();
}

That will add the items to the ObservableCollection that is shown on screen, without navigating to a new page. 


Regards,
Paul Stovell

Rick

unread,
Aug 19, 2011, 5:22:32 PM8/19/11
to magellan-friends

ah...I was so close. I had the view model performing the navigate,
but didn't think about passing a reference of itself to the controller
in order to update the list

Thanks for the quick response.

Rick...
Reply all
Reply to author
Forward
0 new messages