我必须根据 3 个值过滤结果 - "完成"、"待定"和第三个选项,这些选项会在 @datasource.item.Type 中找到任何未"完成"或"待定"的内容
是否可以绑定第三个复选框按钮以显示任何未"完成"或"挂起"的值 - 例如!(类型 = :d 1 或类型 = :p结束(
这是我到目前为止所拥有的屏幕截图,此错误:
Cannot complete binding from nullItemName to @datasources.Data.items.length
( Type = :done or Type = :pending). Unexpected error on binding initial
sync write : Null item name cannot be set to null. in
FiltersDialog.Content.Dropdown1
带有 NOT 查询的下拉菜单的屏幕截图
我想出了一个可能的解决方案,因为这未经测试,但不能保证它会起作用。
这将需要对当前绑定进行以下编辑:
1.( 完全删除名称绑定,并将 nullItemName 设置回"无选择"。
2.( 将选项绑定更改为(@models.Data.fields.Type.possibleValues).concat('Not done or pending')
。
3.( 完全删除值绑定。
4.( 在"值更改"事件的下拉列表中输入以下内容:
if(newValue !== null) {
if (newValue === 'Not done or pending') {
widget.datasource.query.filters.Type._notIn = ['done','pending'];
} else {
widget.datasource.query.filters.Type._equals = newValue;
}
}
为了在选择向类型字段添加其他可能值的情况下提供更好的未来兼容性,并使UI更加万无一失,我建议进行以下编辑和添加:
确保您的"清除"按钮包括:
widget.datasource.query.clearFilters();
widget.root.descendants.Dropdown1.value = null;
修改选项绑定到(@models.Data.fields.Type.possibleValues).concat(‘Not ‘ + (@models.Data.fields.Type.possibleValues).join(‘ or ‘))
将 onValueChange 事件修改为:
if(newValue !== null) {
if(newValue === widget.options[widget.options.length - 1]) {
widget.datasource.query.filters.Type._notIn = widget.datasource.model.fields.Type.possibleValues;
} else {
widget.datasource.query.filters.Type._equals = newValue;
}
}
可能需要对新代码进行细微调整,因为我只是从内存中键入它。实际上,现在我面前没有应用制作工具。