Magento 2 product grid color change
-
12-03-2021 - |
문제
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.
해결책
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
제휴하지 않습니다 magento.stackexchange