Camstar Set Custom Script Handlers For Grid

本文内容仅做参考并不完全通用,测试环境为OpcenterEXCR2410,其中数据均为演示所用无实际意义

自定义JS

1.将自定义JS方法增加到C:\Program Files (x86)\Camstar\Camstar Portal\Scripts\ClientScripts.js文件中

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function GlueMain_Grid_renderComplete() //renderCompleted
{
var theGrid = jQuery(this.GridID);
var jqRowData = theGrid.getRowData();
var rows = theGrid.getDataIDs();

for (var i = 0; i < rows.length; i++) {
var rowData = theGrid.getRowData(rows[i]);
var rowId = rows[i];
var jqRows = theGrid.find('.jqgrow');
var trCurrent = $(jqRows).find("td[title='" + rowId + "']:first").parent("tr:first");
if (rowData["wzmStatus"] == "生产中") {
trCurrent.css("background", "#FFCC99");
}
else if (rowData["wzmStatus"] == "已完成") {
trCurrent.css("background", "#99CC99");
}
}
}

VP配置

1.在VP中为表格属性设置renderCompleted的自定义JS方法(Settings -> CustomScriptHandlers -> renderCompleted)

2.示例效果(根据状态进行变色)