我在A entity自定义了一个字段对应了另一个B entity,依赖了A entity原本的一个字段;
- 该字段无法字段查出对应值
- 该字段不在filter中
- 在filter的propertyFilter中加入该字段,界面可以显示entitypicker,但是查询会报错。
请问是否这样使用不正确?因为原数据库字段无法设置one to many关系,所以加了jmixpropertit,这种情况如何在filter中加一个entitypicker来进行查询
我在A entity自定义了一个字段对应了另一个B entity,依赖了A entity原本的一个字段;
你好,我先理解一下,A实体里面的 dictDateType
是依赖 fdDateType
这个字段手动加载的实体属性。然后你想要把这个属性用在filter里面,对吧?
是的,想用一个下拉选项。目前xml这样配置,java端给combox设置options,但是后端引入这个combobox会报错
自己写一个entitycombobox,然后设置valuechange事件,重新设置Dc是可以的。
但是能使用filter,跟filter默认的一起是最好的。
这个combobox我能否自己设置option的值,不用optionEnum
你好,因为这个combobox是在 Configuration 里面,因此没有放到可注入的上下文中。可以通过代码这么获取:
@Autowired
private Filter filter;
@Subscribe
public void onInit(InitEvent event) {
// 参数是 xml 中 <configuration> 的 id
var typeCodeConf = filter.getConfiguration("typeCodeConf");
// 这里我们知道是 PropertyFilter,因此能强转。
var filterComponent = (PropertyFilterImpl<String>)typeCodeConf.getRootLogicalFilterComponent().getFilterComponents().get(0);
// 强转理由同上
var vComponent = (ComboBox<String>)filterComponent.getValueComponent();
vComponent.setOptionsMap(Map.of("order1","order_1","order2","order_2"));
}
建议官方底层修复一下,studio可以inject尽量可以使用
https://forum.jmix.io/t/custom-property-filter-component-inject-failed/3188 created in En forum.