Pregunta

I see many posts regarding the order grid color change, but I want to know how to change the product grid color change.

If anybody else did this, please let us know.

¿Fue útil?

Solución

Please copy those files and move them to the your theme. add this code in below file

 attr="style: getColorStyle($row())"

vendor/magento/module-ui/view/base/web/templates/grid/listing.html

 <tr class="data-row" repeat="foreach: rows, item: '$row'" css="'_odd-row': $index % 2" attr="style: getColorStyle($row())">
  <td outerfasteach="data: getVisible(), as: '$col'" css="getFieldClass($row())" click="getFieldHandler($row())" template="getBody()"/>
 </tr> 

and add this function in below file

 getColorStyle: function(row)
 {
  /*
   var jsonData = JSON.stringify(row);
   console.log(jsonData);
  */
    styles = '';
  if(row['status'] == '1'){
   styles =  'background: #fefafa';
  }else if(row['status'] == '2'){
   styles =  'background: #6a0dad';
  }else{
    styles = '';
  }
  return styles;
 }

vendor/magento/module-ui/view/base/web/js/grid/listing.js

Licenciado bajo: CC-BY-SA con atribución
No afiliado a magento.stackexchange
scroll top