Hello there,
I'm stuck with an issue using filters in columns in a grouped ListGrid.
The grid was created this way:
The columns set like this:
One of the problems is with de code in bold (userEmailAssociationField). The combobox appears in the filter place, but it doesn´t show the items such as in the cells itself (sometimes it does, though). I'm using the same static LinkedHashMap for both. Another situation is that the grid won´t filter when for instance the user enters a text in nameAssociationField. Is that due to the grid is grouped by another column?
Any help?
Thanks a lot.
I'm stuck with an issue using filters in columns in a grouped ListGrid.
The grid was created this way:
Code:
vehicleFenceGrid = new ListGrid(); vehicleFenceGrid.setHeight100(); vehicleFenceGrid.setWidth100(); vehicleFenceGrid.setFixedRecordHeights(true); vehicleFenceGrid.setCellHeight(32); vehicleFenceGrid.setMargin(5); vehicleFenceGrid.setBorder("1px solid " + BORDER_COLOR); vehicleFenceGrid.setAutoFetchData(false); vehicleFenceGrid.setSelectionAppearance(SelectionAppearance.ROW_STYLE); vehicleFenceGrid.setSelectionType(SelectionStyle.MULTIPLE); vehicleFenceGrid.setCanMove(true); vehicleFenceGrid.setGroupByField(VehicleFenceConstants.VEHICLE_ID); vehicleFenceGrid.setCanUpdate(true); vehicleFenceGrid.setFilterLocalData(true); vehicleFenceGrid.setDataFetchMode(FetchMode.LOCAL);
Code:
private void setVehicleFenceGridFields() { idGridField = new ListGridField(SimpleListGrid.GRID_ID_FIELD); idAssociationField = new ListGridField(FenceConstants.ID); idAssociationField.setHidden(true); vehicleIdAssociationField = new ListGridField(VehicleFenceConstants.VEHICLE_ID); vehicleIdAssociationField.setHidden(true); vehicleNameAssociationField = new ListGridField(HistoryEntryFieldsConstants.FIELD_VEHICLE_NAME); vehicleNameAssociationField.setHidden(true); vehiclePlateAssociationField = new ListGridField(HistoryEntryFieldsConstants.FIELD_VEHICLE_LICENSE_PLATE); vehiclePlateAssociationField.setHidden(true); isOrderedField = new BooleanListGridField(VehicleFenceConstants.FENCE_ORDERED, CONSTANTS.sortable()); isOrderedField.setCanToggle(true); vehicleFenceGrid.setBooleanTrueImage(null); vehicleFenceGrid.setBooleanFalseImage(null); isOrderedField.setCanFilter(false); isOrderedField.setWidth("20%"); [B] // editor config[/B] [B] userEmailAssociationField = new ListGridField(UserPortalOrionFieldsConstants.USER_EMAIL_ID, CONSTANTS.userEmail()); userEmailAssociationField.setRequired(false); userEmailAssociationField.setSortByDisplayField(true); SelectItem userEmailSelectItem = new SelectItem(); userEmailSelectItem.setAllowEmptyValue(true); userEmailAssociationField.setEditorProperties(userEmailSelectItem); userEmailAssociationField.setCanEdit(true);[/B] [B] // filter config userEmailAssociationField.setFilterOnKeypress(true); userEmailAssociationField.setCanFilter(true); userEmailAssociationField.setFilterEditorProperties(new SelectItem()); userEmailAssociationField.setFilterEditorValueMap(userMap);[/B] fenceTypeAssociationField = new ListGridField(VehicleFenceConstants.FENCE_TYPE, "fenceType"); fenceTypeAssociationField.setHidden(true); fenceWebAssociationField = new ListGridField(VehicleFenceConstants.FENCE_WEB, "fenceWeb"); fenceWebAssociationField.setHidden(true); fenceClientAssociationField = new ListGridField(VehicleFenceConstants.CLIENT_ID, "clientId"); fenceClientAssociationField.setHidden(true); fenceMacroGroupAssociationField = new ListGridField(VehicleFenceConstants.FENCE_MACRO_GROUP, "MacroGroupId"); fenceMacroGroupAssociationField.setHidden(true); nameAssociationField = new ListGridField(VehicleFenceConstants.FENCE_NAME, CONSTANTS.name()); [B]nameAssociationField.setCanFilter(true);[/B] nameAssociationField.setCanEdit(false); nameAssociationField.setWidth("40%"); fencePriorityAssociationField = new ListGridField(VehicleFenceConstants.FENCE_PRIORITY, CONSTANTS.fencePriority()); fencePriorityAssociationField.setAlign(Alignment.LEFT); fencePriorityAssociationField.setWidth("15%"); fencePriorityAssociationField.setCanSort(false); fencePriorityAssociationField.setCanFilter(false); fencePriorityAssociationField.setCanEdit(false); fencePriorityAssociationField.setCellFormatter(new CellFormatter() { @Override public String format(Object value, ListGridRecord record, int rowNum, int colNum) { String result = ""; if (value != null) { int priorityCode = Integer.parseInt(value.toString()); result = FencePriorityValueMapProvider.getValueMap().get( priorityCode); } return result; } }); vehicleFenceGrid.setFields(idGridField, vehicleIdAssociationField, vehicleNameAssociationField, vehiclePlateAssociationField, isOrderedField, userEmailAssociationField, nameAssociationField, fencePriorityAssociationField, /* shapeAssociationField , colorAssociationField , */ idAssociationField/* , groupAssociationField */); }
Any help?
Thanks a lot.
Comment