yii2-scroll-pager icon indicating copy to clipboard operation
yii2-scroll-pager copied to clipboard

Star widget on yii2 scroll pager

Open rajanmidd opened this issue 9 years ago • 4 comments

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.

rajanmidd avatar Jan 19 '16 07:01 rajanmidd

do you have any solutions?

ivanmfan avatar Mar 20 '17 15:03 ivanmfan

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

omer-sds avatar Jul 20 '17 20:07 omer-sds

$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);``

hiteshjangid avatar Apr 15 '19 10:04 hiteshjangid

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 :

'rating', 'id' => 'YOUR ID NAME HERE', 'pluginOptions' => [ 'min' => 0, 'max' => 5, 'step' => 0.5, 'size' => 'sm', ], ]); ?>

At last thank to omer-sds

amtz2000 avatar Sep 23 '21 02:09 amtz2000