This is a migrated thread and some comments may be shown as answers.

Animating 'visible' binding

2 Answers 131 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
Jeremy Wiebe
Top achievements
Rank 1
Jeremy Wiebe asked on 04 Oct 2012, 08:18 PM
So today I was using the 'visible' binding and I really wanted to have some jQuery animation when the bound element was shown/hidden.  A few minutes of research and I have a new binding (I _could_ have just extended the built-in one, but I didn't want to touch so that I didn't affect other areas of the application I've already built).  

Just drop this javascript in a file that is loaded after the kendo javascript:

kendo.data.binders.visible_animated = kendo.data.Binder.extend({
  refresh: function () {
    if (this.bindings.visible_animated.get()) {
      $(this.element).show('fast');
    } else {
      $(this.element).hide('fast');
    }
  }
});

Alternatively, it'd be cool if the built-in kendo bindings that controlled element visibility would support animations natively somehow.  :-)

2 Answers, 1 is accepted

Sort by
0
J
Top achievements
Rank 1
answered on 09 Sep 2014, 11:26 PM
I did something similar, with a couple of additions:
http://blog.falafel.com/fading-item-visibility-with-a-kendo-ui-binding/
0
Alon
Top achievements
Rank 1
Veteran
answered on 24 Feb 2017, 01:59 PM
This is awesome. Thank you for posting this!
Tags
MVVM
Asked by
Jeremy Wiebe
Top achievements
Rank 1
Answers by
J
Top achievements
Rank 1
Alon
Top achievements
Rank 1
Veteran
Share this question
or