在这种情况下,我希望网格行是特定的颜色,这是根据该行中的某个字段设置的。
我看过这个案子:
How can we set color for particular column filed value conditionally in Acumatica
也是在这里:
http://asiablog.acumatica.com/2016/12/using-colors-in-acumatica.html
在某种程度上起作用了。不幸的是,它只在单击其中一行时更改颜色,而不是在加载屏幕或更新字段和单击保存时更改颜色。当页面刷新或保存发生时,事件"grid_RowDataBound“不触发吗?
底线:在刷新屏幕或更新/保存字段时,如何设置行颜色?
如果用户必须单击其中一行才能实现此功能,则没有多大用处。
谢谢..。
发布于 2022-01-25 01:46:10
将javascript方法放在PXDataSource aspx控件下更好:
<px:PXDataSource>
<ClientEvents Initialize="HighlightLines" CommandPerformed="HighlightLines"/>
</px:PXDataSource>
<script type="text/javascript">
function HighlightLines ()
{
if(px_all && px_all["ctl00_phG_grid <=the html ID of the grid"] && px_all["ctl00_phG_grid"].rows)
{
let lines = px_all["ctl00_phG_grid"].rows.items;
for(let i=0;i<lines.length;i++)
{
let currentLine=lines[i];
if(currentLine.getCell("DAC__Field").getValue() == 'SomeValue')
{
currentLine.style = 'background-color: green';
currentLine.repaint();
}
else if (currentLine.getCell("DAC__Field").getValue() == 'SomeOtherValue')
{
currentLine.style = 'background-color: yellow';
currentLine.repaint();
}
else if (currentLine.getCell("NGSampleTest__Test").getValue() == 'PGTAND')
{
currentLine.style = 'background-color: red';
currentLine.repaint();
}
}
}
}
</script>https://stackoverflow.com/questions/70840294
复制相似问题