netsuite - SuiteScript 2.0 Suitelet Sublist with line-specific "Select" options
问题描述
I currently have a nice suitelet popup as a PDF Report selection. Everything so far works nicely.
However, some of the available PDF reports require individual options to be passed. ie. a date, or a class selction specific to ONLY 1 of the forms.
Currently I have created the sublist:
var documentList = form.addSublist({
id: 'documentlist',
label: 'Documents Available'+ (data.job ? ' for Job Number: '+data.job : ''),
type: serverWidget.SublistType.LIST
})
documentList.addField({ id: 'mark', type: 'CHECKBOX', label: 'Print'});
documentList.addField({ id: 'config', type: 'SELECT', label: 'Form', source: 'customrecord_advancedformconfig' }).updateDisplayType({displayType : 'INLINE'});
documentList.addField({ id: 'vardate', type: 'CHECKBOX', label: 'Variation Dates' }).updateDisplayType({displayType : 'INLINE'});
documentList.addField({ id: 'document', type: 'TEXT', label: 'Document', }).updateDisplayType({displayType : 'HIDDEN'});
documentList.addField({ id: 'primaryrecord', type: 'TEXT', label: 'Main Record'}).updateDisplayType({displayType : 'INLINE'});
documentList.addField({ id: 'storeincabinet', type: 'CHECKBOX', label: 'Save to Cabinet'}).updateDisplayType({displayType : 'INLINE'});
documentList.addField({ id: 'filename', type: 'TEXT', label: 'File Name to be Generated'}).updateDisplayType({displayType : 'NORMAL'});
var pdfOptions = documentList.addField({ id: 'formoption', type: 'SELECT', label: 'Option' }).updateDisplayType({displayType : 'NORMAL'});
The last line is the sublist field for the form options.
Lets assume the first line requires a couple of date options, while the second line requires a couple of size or colour options.
As there is only a "field" action to pdfOptions.addSelectOption(...)
this adds options to ALL occurences of the field.
Is there a method for each LINE of the sublist, to set options for just a single line??
There is no pdfOptions.addSublistSelectOption(...)
so I'm going to guess the answer is not, but thought I would ask anyway.
To illustrate, see below image... Only the last line should have a date dropdown.
解决方案
The way I've accomplished having different select options for different lines is using a client script with the lineInit
entry point that cleared out the existing options and added relevant ones for that line.
However you would need to change the sublist type from LIST
to EDITOR
or INLINEEDITOR
for this to work, which probably wouldn't work well in your use case.
推荐阅读
- python - 如何将新方法结合到旧方法中?
- javascript - 在角度打字稿中显示对象列表中的键和值
- javascript - 这个函数是 O(n^3) 吗?
- javascript - 如何在同一页面上同时运行两个三个 JS 对象并设置动画?
- html - 在 AG-Grid 中显示复杂的键值对
- apache-kafka - 基于分区Key的主题分区
- javascript - 如何在jQuery中选择具有自定义属性名称的最接近的属性
- python-3.x - 从下面的响应/输出中提取 'Status': 'COMPLIANT'
- yii - 如何在页面更新/编辑时默认显示基于父下拉列表值的子下拉列表
- javascript - LF 框架解决数据科学问题