Javascript 如何在SAPUI5中使用数据表中的列内容时将列可见性设置为false
当我在datatable上使用setVisible(false)将列可见性设置为false时,我使用该特定列内容为行着色的逻辑不起作用。当我将列可见性移除为false时,它会正确地为行着色。如您所见,我使用最近的(“tr”)来获取最近的行,并根据列单元格值对其进行着色,但我不希望该列显示在表中Javascript 如何在SAPUI5中使用数据表中的列内容时将列可见性设置为false,javascript,jquery,datatables,sapui5,Javascript,Jquery,Datatables,Sapui5,当我在datatable上使用setVisible(false)将列可见性设置为false时,我使用该特定列内容为行着色的逻辑不起作用。当我将列可见性移除为false时,它会正确地为行着色。如您所见,我使用最近的(“tr”)来获取最近的行,并根据列单元格值对其进行着色,但我不希望该列显示在表中 oTable.addColumn(new sap.ui.table.Column({ label : new sap.ui.commons.Label({
oTable.addColumn(new sap.ui.table.Column({
label : new sap.ui.commons.Label({
text : "Totaltype"
}),
template : new sap.ui.commons.TextField().bindProperty("value",
"Totaltype", function(cellValue){
//var backgroundColorChanged = false;
switch(cellValue){
case 'S':
backgroundColor = 'yellow';
backgroundColorChanged = true;
break;
case 'T':
backgroundColor = 'red';
backgroundColorChanged = true;
break;
default:
backgroundColor = 'white';
}
//if (backgroundColorChanged == true){
// backgroundColorChanged = false;
cellId = this.getId();
//$("#"+cellId).parent().parent().css("background-color",backgroundColor);
//}
$("#"+cellId).closest("tr").css("background-color",backgroundColor);
return cellValue;
}),
sortProperty : "Totaltype"
}).setVisible(false));