我目前正在尝试更新一行的值 - 取决于使用jQuery的另一个值的行。
例如:
如果会议室分配=待处理,则“操作”下会显示“编辑”和“取消”按钮 如果会议室分配!=待定,则“操作”
下会显示“编辑”和“拒绝”按钮我该怎么做?
这里有一个小提琴:http://jsfiddle.net/S9Gwy/
到目前为止,这是我的代码:
$('.results_tbl').dataTable({
"bPaginate": true,
"bLengthChange": false,
"bFilter": true,
"bSort": true,
"bInfo": false,
"bAutoWidth": true
});
/*====================================
determining whether cancel or decline
button is going to appear depending on
room allocation status
=====================================*/
// find all the booking rows
var bookingRows = $('table tr.booking');
// stash a reference to the row
bookingRows.each(function () {
var row = $(this);
// if you can add a class of 'pending' to the status <td>, this becomes even cleaner and nicer...
// check the contents of the status column
if (row.find('td.status').text().toLowerCase() == 'pending') {
// add a class to the row so the CSS can do its thing...
row.addClass('pending');
}
});
答案 0 :(得分:1)
第一个(行级)解决方案可能是这样的:
tr.booking .cancelall {
display: none;
}
tr.booking.pending .cancelall {
display: inline-block;
}
tr.booking.pending .declineall {
display: none;
}