Suitelt 2.0 子列表名称显示不需要的行为

问题描述 投票:0回答:1

在 NetSuite Suitelet 开发中,由于默认的系统行为,子列表标签通常会变成可单击的链接。我们希望将这些标签显示为纯文本,没有任何链接功能。有什么办法可以实现这一点吗?我们不希望出现屏幕截图中所示的右键窗口,或者它应该是简单的纯文本。屏幕截图

我们尝试了不同的子列表类型,但我们无法使用它们,因为我们希望子列表行可编辑。

javascript netsuite suitescript suitescript2.0 sublist
1个回答
0
投票

这可能不是最佳实践,但我认为它会有所帮助。要删除 NetSuite Suitelet 中子列表标签的可点击行为,您可以添加一个带有脚本标记的隐藏内联 HTML 字段,该脚本标记强制 CSS 禁用特定子列表标签类的指针效果(即光标:默认)。

可能有帮助的更多详细步骤:

  1. 检查子列表元素:

    • 右键单击浏览器中的子列表标签,然后选择“Inspect”(或使用浏览器 DevTools)。
    • 识别具有链接行为的标签的类别。
  2. 在 Suitelet 中添加隐藏的内联 HTML 字段: 使用

    form.addField
    创建注入自定义 CSS 和 JavaScript 的内联 HTML 字段。该脚本将通过将光标更改为
    default
    并禁用链接行为来修改子列表标签的样式。

代码片段:

...
let inlineHtmlField = form.addField({
    id: 'custpage_hidden_html',
    type: serverWidget.FieldType.INLINEHTML,
    label: 'Hidden HTML'
});

let inlineHtmlField = form.addField({
    id: 'custpage_hidden_html',
    type: serverWidget.FieldType.INLINEHTML,
    label: 'Hidden HTML'
});

// Set the script in the inline HTML field content
inlineHtmlField.defaultValue = '<script>' +
    'document.addEventListener("DOMContentLoaded", function() {' +
    '    var sublistLabels = document.querySelectorAll("THE_CLASS_NAME_TO_BE_UNCLICKABLE");' + 
    '    sublistLabels.forEach(function(label) {' +
    '        label.style.cursor = "default";' +  // Set cursor to default (remove pointer)
    '        label.removeAttribute("href");' +   // Remove link behavior
    '    });' +
    '});' +
    '</script>';
...
© www.soinside.com 2019 - 2024. All rights reserved.