0

MVVM - force 'loading spinner' to always show up when onClick command fires to refresh

asked 2012-10-12 17:34:11 +0800

rickcr gravatar image rickcr
704 7

I'm relying on the default 'Loading' spinner to be applied upon ajax calls via ZK. (From another thread I got help on how to be sure that loading spinner is alway centered and modal on the whole screen.) My question now though is...

The "loading" doesn't always show up nor does the screen even flicker all the time - probably because the ajax service call is returning too quickly? I know the loader event fires in the javascript since if I put alert in there it always fires - it's jus that you can't always see any feedback on the screen that your click even actually did something.

Is there a way to always force the loading box to appear albeit very briefly - even if it's just a screen flicker that would be cool.

I'm also using a ViewModel to back my Listbox so finding examples how to do all this with an MVVM architecture is challenging.

It's pretty basic.. I have

<image src="/images/icon-refresh-white-12-16x.png" style="cursor:pointer;" onClick="@command('refreshGrid')" />

<listbox model="@bind(vm.employees)" ... />

//Command in View model..
@NotifyChange("employees")
@Command
public void refreshGrid() {
     this.employees = service.getEmployees();

Note sometimes the "loading" box will show up briefly other times it doesn't. I want at least some screen flicker even if I have to delay things by a second to make it happen.

delete flag offensive retag edit

1 Reply

Sort by ยป oldest newest

answered 2012-10-19 07:48:53 +0800

jumperchen gravatar image jumperchen
3909 2 8
http://jumperchen.blogspo... ZK Team

Have you tried with Echo Event?

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2012-10-12 17:34:11 +0800

Seen: 86 times

Last updated: Oct 19 '12

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More