Yii2 - Kartik-StarRating widget not working for array of models

I am working on the star rating widget of kartik-v. I have gone through the links kartik-StarRating(http://demos.krajee.com/widget-details/star-rating) and karik-BootStarp(http://plugins.krajee.com/star-rating). Facing the below issue while implementing this widget.

Issue: The widget is only getting displayed for the very first element in the array of models.

Below is the abstract version of logic I use:

Model: Model class created for the table to which kartik-v widget is to be implemented.

Controller: Array of models created here and passed to view for rendering.

View: I use the below code for rendering.

/* $i is the loop variable and 

   there are array of forms and array of models in the in the view */

$formArray[$i]->field($modelArray[$i], 'rating')->label('')->

                    widget(StarRating::classname(), [

                                  'pluginOptions' => [

                                    'step' => 0.1,

                                    'size' => 'sm',



The above code is working(displaying the star widget) for the very first element in the array but not working for the remaining element in the array. Loading symbol appears for remaining elements.