如何更新数据源字段值



我需要更新一个 DataSourceTextField。基本上我在代码中这样做:

    DataSourceTextField partDataSourceField = new DataSourceTextField(
            partFieldName, constants.partTitle());
    partDataSourceField.setValueMap(partCodesList);
    documentsResultDataSource.setFields(partDataSourceField,
            titleDataSourceField);

该代码在数据源上生成一个"部件"列表,供我过滤结果。

我一直在尝试的是动态更改此列表以将其设置为仅显示结果中可用的值。我试过这个无济于事:

        DataSourceField partField = documentsResultDataSource.getField(partFieldName);
        LinkedHashMap<String, String> partCurrentCodesList = new LinkedHashMap<String, String>();
        partCurrentCodesList.put("Test", "Test");
        partField.setValueMap(partCurrentCodesList);

是否有可能完成我需要的东西?

我删除了DataSourceTextField,然后:

documentsResultDataSource.setFields(partDataSourceField, 标题数据源字段);

这是次优的,但我找到的最佳解决方案。

最新更新