如何在此渲染器中添加一个类,询问是否启用或禁用了Office,如果禁用则应添加此类maven_build:
image: tomsontom/oracle-java8-mvn
script:
- cd Code
- apt-get update && apt-get upgrade -y
- DEBIAN_FRONTEND=noninteractive apt-get install openjfx xserver-xorg-video-dummy xserver-xorg-input-void xinit fonts-freefont-ttf pulseaudio pulseaudio-utils libavformat-ffmpeg56 wget libswt-gtk-3-java firefox -y
- wget https://xpra.org/xorg.conf -O /etc/X11/xorg.conf
- service dbus start
- xinit -- :0 -nolisten tcp vt$XDG_VTNR -noreset +extension GLX +extension RANDR +extension RENDER +extension XFIXES &
- DISPLAY=:0 pulseaudio --exit-idle-time=-1 &
- DISPLAY=:0 mvn --batch-mode package
- cd target && ls -la
。我在寻找类似的问题,但是没有一个起作用。
table-active
我找到的答案之一是这个var table = $('#tbl_1').DataTable({
"order": [
[1, "asc"]
],
"destroy": true,
"ajax": {
"method": "POST",
"url": "JSON/Office.php"
},
"iDisplayLength": 15,
"columns": [ {
"data": "Office",
"width": "20%"
}, {
"data": "Status",
"searchable": false,
"sortable": false,
"aling": "center",
"render": function(data, type, row) {
var Status = row["Status"];
if (Status == 'FALSE') {
return '<button class="btn btn-sm btn-success active" onclick="enable_item(this)"title="Active">Active</button>';
} else {
return '<button class="btn btn-sm btn-danger disable" onclick="disable_item(this)" title="Disable"> Disable</button>';
}
}
}],
"dom": '<"dt-buttons"Bf><"clear">lirtp',
"paging": true,
"autoWidth": true,
buttons: [{
extend: 'excel',
text: 'Excel'
}]
});
,但仍然没有用:(。我希望我向大家致以良好的问候
答案 0 :(得分:5)
如果我理解的正确,并且想向<tr>
元素中添加类,则可以使用createdRow
钩子-https://datatables.net/reference/option/createdRow。
$('#tbl_1').dataTable({
"createdRow": function( row, data, dataIndex ) {
if ( data["Status"] == false ) {
$(row).addClass( 'table-active' );
}
}
});