获取subgrid中的数据并修改,含添加刷新列表的事件

时间:2023-03-13 21:46:02
var isAddRefresh = false;

function setLawsuitQueryResultText() {
var queryResultIndex = 7; var gridControl = window.parent.document.getElementById('lawsuitquery').control;
if (gridControl) {
var linkElement = '<nobr class="gridcellpadding" title="查询失败"><span style="color:grey;">查询失败</span></nobr>';
var innerGrid = gridControl.getRecordsFromInnerGrid();
if (innerGrid.length > 0) {
for (var i = 0; i < innerGrid.length; i++) {
var queryResult = gridControl.getRecordsFromInnerGrid()[i][3].cells[queryResultIndex].outerText; if (queryResult) {
if (queryResult.indexOf('查询失败') > -1) {
$(gridControl.getRecordsFromInnerGrid()[i][3].cells[queryResultIndex]).html(linkElement);
} else {
$(gridControl.getRecordsFromInnerGrid()[i][3].cells[queryResultIndex]).find('a').text('查询结果');
$(gridControl.getRecordsFromInnerGrid()[i][3].cells[queryResultIndex]).find('a').css('color', '#1160B7');
}
}
}
} if (!isAddRefresh) {
gridControl.add_onRefresh(setLawsuitQueryResultText);//给subgrid添加刷新列表后的事件
isAddRefresh = true;
}
} else {
setTimeout("setLawsuitQueryResultText()", 500);
}
}