Yii Framework Forum: Clistview - Make An Animation Before Ajax Update - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Clistview - Make An Animation Before Ajax Update Rate Topic: -----

#1 User is offline   karim gioca 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 83
  • Joined: 21-September 10

Posted 31 January 2013 - 06:48 AM

Hi everyone,
i want to make a js animation like fade or slidUp in the div that contain the Clistview content before it render the next/previous page.
Is that possible ?
I tried the beforeAjaxUpdate property but it gives me nothing, but it execute the function tat i give to it when loading the page.
exemple :
    <?php $this->widget('zii.widgets.CListView', array(
            ...........
            "beforeAjaxUpdate"=>"animation('yw0')"
            ..................
    ));
    ?>

animation('yw0') is a js function tat contain the fade or slidup or anything else, the problem that this function is executed only when i load the page, and do not execute when i change the page from pager...
0

#2 User is offline   Luke Jurgs 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 162
  • Joined: 16-October 11
  • Location:Australia

Posted 31 January 2013 - 07:25 AM

It expects a javascript function, might seem unintuitive but you need to wrap it in a function to make it work:

    <?php $this->widget('zii.widgets.CListView', array(
            ...........
            "beforeAjaxUpdate"=>"function() { animation('yw0'); }"
            ..................
    ));
    ?>


This is because what you are setting is a function call not a function reference. Internally (in jQuery) it is doing something like:

  animation('yw0').apply(this, arguments);


So unless animation('yw0') returns a function reference, not a lot will happen here.

View Postkarim gioca, on 31 January 2013 - 06:48 AM, said:

Hi everyone,
i want to make a js animation like fade or slidUp in the div that contain the Clistview content before it render the next/previous page.
Is that possible ?
I tried the beforeAjaxUpdate property but it gives me nothing, but it execute the function tat i give to it when loading the page.
exemple :
    <?php $this->widget('zii.widgets.CListView', array(
            ...........
            "beforeAjaxUpdate"=>"animation('yw0')"
            ..................
    ));
    ?>

animation('yw0') is a js function tat contain the fade or slidup or anything else, the problem that this function is executed only when i load the page, and do not execute when i change the page from pager...

1

#3 User is offline   karim gioca 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 83
  • Joined: 21-September 10

Posted 31 January 2013 - 08:13 AM

View PostLuke Jurgs, on 31 January 2013 - 07:25 AM, said:


    <?php $this->widget('zii.widgets.CListView', array(
            ...........
            "beforeAjaxUpdate"=>"function() { animation('yw0'); }"
            ..................
    ));
    ?>


Yeah ! tnx it works !
but a new problem apears here :
i put a slideUp animation in the "animation" function, but the ajax update don't let the animation end, it just make the update on the content before even the content ends its sliding...
I can use the "beforeAjaxUpdate" and "afterAjaxUpdate" attributes to combine some animation to get my pursoe, but is there a way to sopt update until an event come to its end ?
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users