经过不断变换尝试,此问题终得到解决:
contentPane.on("cellselect", function(td) { //获取元格被选中监听事件
var num = contentPane.curLGP.getTDRow(td);
if (num > 17 && $(this).text() != null) {
$("td[id^='B']").each(function() {//判断B列是否为空,由于这一行只有几个按钮,所以B列没有值
if ($(this).attr("row") > 17 && $(this).attr("row") != num&& $(this).text() == "") {
$("tr[tridx=" + $(this).attr("row") + "]").hide();
} else {
document.getElementById('r-' + num + '-0').style.display = '';
}
});
}
});
另外为了在页面加载后,让按钮默认隐藏,所以对页面中的任意一个按钮里写了个初始化后代码:
$("td[id^='B']").each(function() {
if ($(this).attr("row") > 17 && $(this).text() =="") {
$("tr[tridx=" + $(this).attr("row") + "]").hide();
}});
