kop / yii2-scroll-pager

Infinite AJAX scrolling for Yii2 ListView widget
https://kop.github.io/yii2-scroll-pager/
MIT License
180 stars 63 forks source link

Star widget on yii2 scroll pager #51

Open rajanmidd opened 8 years ago

rajanmidd commented 8 years ago

Hello All, Please help me on this.

I am using the yii2 scroll pagination and in the pagination use the ListView::widget.

when i scroll the page a button shows names as "load more " when i click on that link it load the items but rating start is not showing. Can you please help me on this.

ivanmfan commented 7 years ago

do you have any solutions?

omer-sds commented 7 years ago

hi @ivanmfan and @rajanmidd you can use the following approach to load star rating after page load , add the following option inside the pager option in the list view

'eventOnRendered' => new \yii\web\JsExpression ( 'function(){var optVar = $("your_target_input_object_or_selector").attr("data-krajee-rating");options = window[optVar];$("your_target_input_object_or_selector").rating(options);}' )

hope this solves your problem

hiteshjangid commented 5 years ago
$script =<<<JS
    jQuery.ias().on('rendered', function(items) {
        $(".rating-widget").attr("data-krajee-rating"); // rating-widget given class to rating widget
        options = window[optVar];
        $(".rating-widget").rating(options);
    });
JS;
$this->registerJs($script);``
amtz2000 commented 3 years ago

I have fixed this problem. according "omer-sds commented on 21 Jul 2017" answer that we could maybe fix one time in instance but Multiple instances. so here the deal.

put this code after the starRating widget like this :

<?php echo StarRating::widget([ 'name' => 'rating', 'id' => 'YOUR ID NAME HERE', 'pluginOptions' => [ 'min' => 0, 'max' => 5, 'step' => 0.5, 'size' => 'sm', ], ]); ?>

At last thank to omer-sds