Announcement
Collapse
No announcement yet.
X
-
Well, you have to return the Criterion from the methods you are required to implement.
I did something here:
Code:setCriterionGetter(new FormItemCriterionGetter() { @Override public Criterion getCriterion(DynamicForm form, FormItem item, TextMatchStyle textMatchStyle) { return this.getCriterion(form, item); } @Override public Criterion getCriterion(DynamicForm form, FormItem item) { SelectItem si = (SelectItem) item; if (si.getSelectedRecords() != null && si.getSelectedRecords().length > 0) { AdvancedCriteria finalOrCrit = new AdvancedCriteria(OperatorId.OR); for (int i = 0; i < si.getSelectedRecords().length; i++) { String productId = si.getSelectedRecords()[i].getAttributeAsString(DatasourceFieldEnum.T_PRODUCT__ID.getValue()); productId = ", " + productId + ","; finalOrCrit.appendToCriterionList( new Criterion(DatasourceFieldEnum.V_LEAD_PRODUCTLIST__PRODUCTID_LIST_SEP.getValue(), OperatorId.CONTAINS, productId)); } return finalOrCrit; } else return null; } });
Apply this to your TextItem. Then use that TextItem in ListGridField.setEditorProperties().
Perhaps (I did not use this so far) it is also enough to just use FormItem.setCriteriaField() and let your TextItem point to the valueField instead. The "ListGrid data must include the valueField" applies nevertheless.
Best regards
Blama
Leave a comment:
-
Hi Blama,
I am not able to understand how to implement this. Do you have any example. I want the filter to be a textitem and filter data on field values and not on display field that i set in select item as editor type of that field.
Leave a comment:
-
Hi swatiagarwal,
see these docs and apply it to the TextItem you use in setFilterEditorType(). Also, I'm using ListGridField.setEditorProperties() instead.
Best regards
Blama
Leave a comment:
-
Hi
I am using the same example as above. I have set grid.setShowFilterEditor(true);
Because i have set display field, the filter appears as selectItem. But i do not want the filter to appear as select item.
I tried, gridField.setFilterEditorType(new TextItem());
But in this case the filter does not work because filter functionality works on display field.
Leave a comment:
-
Hi,
Editing and Displaying is very different.
Assuming you are using a .ds.xml-backed DataSource:- Add a foreignKey-attribute to you id-field (perhaps with joinType="outer", if it can be null)
- Add a new field with includeFrom="parentDS.displayField"
- Add a new attribute displayField to the id-field, pointing to the new field from step 2
Best regards
Blama
Leave a comment:
-
Select item as editor in ListGridField not displaying proper value
Hello,
I am using chrome browser and SmartClient Version: v11.0p_2017-02-11/PowerEdition Deployment (built 2017-02-11)
I am using ListGrid component. One of list grid field has editor type as select item. In select item there are two pick list field. I am setting display field and value field of select item properly.
When Grid row is in editable state then proper display value is displayed but when gird is not in editable state it is displaying value field of select item. I want display field should visible everytime.
Code:
ListGrid vendorMaterialGrid = new ListGrid();
ListGridField materialField = new ListGridField("materialCode");
vendorMaterialGrid.setEditorCustomizer(new ListGridEditorCustomizer() {
@Override
public FormItem getEditor(final ListGridEditorContext context) {
SelectItem materialselectItem = new SelectItem();
ListGridField materialField = new ListGridField("materialCode");
materialselectItem.setWidth(200);
materialField.setWidth(60);
ListGridField descriptionField = new ListGridField("description");
descriptionField.setWidth(140);
materialselectItem.setDisplayField("materialCode");
materialselectItem.setValueField("descripiton");
materialselectItem.setPickListFields(materialField, descriptionField);
return materialselectItem;
}
});
Please help me out.
ThanksTags: None
Leave a comment: