This is my listing.xml code for rating . I want to display star rating to the custom feedback grid.

<column name="rating">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="bodyTmpl" xsi:type="string">ui/grid/cells/html</item>
                <item name="label" xsi:type="string" translate="true">Rating</item>

I want Something like this

I want something like this.

  • you can get the rating value from PDP page ..just use this logic
    – Pramod
    Commented Jan 3, 2020 at 9:36
  • What is PDP page? Can you please explain it?Thank you Commented Jan 3, 2020 at 10:05
  • by default rating is available on PRODUCT DETAIL PAGE from there you can the value of ratings
    – Pramod
    Commented Jan 3, 2020 at 10:06
  • Its a custom module and i am storing data into my custom table. On bases of the data stored in db, i want to display star rating as shown above.Currently its displaying 1 to 5 as output. Commented Jan 3, 2020 at 10:10

1 Answer 1


I got the answer. I create class for rating.php in ui->component->Listing->column and displayed value in rating.html file in view->adminhtml->web->tamplate. That worked for me. I will now return css class and add it to my html code to make it look bit better.Thank you all for you helping. If there is better way let me know.


public function prepareDataSource(array $dataSource)
        foreach($dataSource['data']['items'] as &$item){
                $data = [];
                for($i = 0; $i < 5; $i++)
                    if($i < $item['rating'])
                        $data[] = 'selected';
                        $data[] = 'notSelected';

                $item['rating'] = $data;
    return parent::prepareDataSource($dataSource); // TODO: Change the autogenerated stub


<div class="field required review-field-ratings">
<div class="control review-control-vote" >
    <!--  ko foreach: $col.getLabel($row())   -->
    <!-- ko if: $data == "selected"-->
    <span style="color: rgb(51, 51, 51);">★</span>
    <!-- ko if: $data != "selected"-->
    <span style="color: rgb(204, 204, 204);">★</span>
    <!--    /ko    -->


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.