Javascript 是否只有某些行的“删除”按钮?
我有一个带有数据的掌上电脑,如果需要详细信息,它会有一个属性来指示特定的状态。有没有办法从Hassipped值为true的行中删除remove row按钮 表定义,如果很重要:Javascript 是否只有某些行的“删除”按钮?,javascript,jquery,handsontable,Javascript,Jquery,Handsontable,我有一个带有数据的掌上电脑,如果需要详细信息,它会有一个属性来指示特定的状态。有没有办法从Hassipped值为true的行中删除remove row按钮 表定义,如果很重要: var hot = new Handsontable(container, { data: hotData, dataSchema: { Product: null, UOM: "EA", QtyShipped: 0 }, columns: [
var hot = new Handsontable(container, {
data: hotData,
dataSchema: { Product: null, UOM: "EA", QtyShipped: 0 },
columns: [
{
data: 'Product',
title: "Product",
type: "text",
readOnly: isShipped
},
{
data: 'UOM',
title: "UOM",
readOnly: true,
type: "text"
},
{
data: 'QtyShipped',
title: "Qty<br />Shipped",
type: "numeric",
readOnly: isShipped
}],
allowInsertRow: true,
//allowRemoveRow: true, //TODO: Depending on mode and row
autoWrapCol: true,
colHeaders: true,
columnSorting: { column: 0, sortOrder: false },
contextMenu: ['undo', 'redo', 'row_above', 'row_below', 'remove_row'],
currentColClassName: 'activeCol',
currentRowClassName: 'activeRow',
dropdownMenu: true,
fixedColumnsLeft: 1,
outsideClickDeselects: false,
readOnly: <%= IsWatchList.ToString().ToLower() %>,
removeRowPlugin: true,
rowHeaders: true,
stretchH: "all", //used in conjunction #hot-container styling to make the table take up 100% of parent width
});
考虑到我已经实现了删除一行的代码,并且修改了代码以插入我自己定制的按钮,我知道按钮被注入的位置 多亏了注释,我查看了注入remove row按钮的代码,根据Hassipped属性的值,可以注入或不注入所需的行按钮
if (jsonObject != "") {
if (jsonObject.LoadDetails[row]["HasShipped"] == true) {
div.appendChild(btnNode);
elem.appendChild(div);
}
}
我没有使用此特定库的经验,但您可能需要一些和的组合。嗯,我可以把上下文菜单拿出来,因为它没那么重要。但动态更改设置可能是一个很好的开始,因为我已经根据另一个属性值将特定行中的单元格设置为只读。谢谢你的考虑,我很糟糕,在你的问题上,如果没有某种屏幕截图,remove row按钮是非常模糊的,因此我假设您希望在Hassipped为真时灰显contextMenu的remove row选项如果您可以提供您正在处理的内容的屏幕截图,并指出哪一行代码实际负责生成此remove row按钮,那么它将非常有用帮助别人来帮助你…不,我很好。基于你的问题,我甚至不能半猜半猜答案,所以我给了你一票,因为你自己解决了问题,我的评论在技术上与解决方案无关,哈哈。