Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Boolean field in filter editor cannot be deselected once selected

    SmartGWT 2.5 - I have a ListGrid with a filter editor. When I check the checkbox for a boolean field the filtering works fine. Just no way to uncheck the box. I've tried control-click, shift-click, option-click, command-click.

    #2
    The checkbox should be deselectable - in fact by default it should be a 3 state checkbox so you can test for true, false (or leave unset).
    We ran a sanity check to verify that this does indeed work against a recent 2.5 nightly and it seems fine. You must have something else going on in your app (Perhaps the field is marked as canFilter:false?)

    If you can't pin it down, as always, post a test case that demonstrates the problem and we'll take a look

    Thanks
    Isomorphic Software

    EDIT: Just to clarify - a simple click should be all that's required - no need for ctrl+click or other modifiers.

    Comment


      #3
      I checked another grid with a boolean field and it does work, so it is something with this particular grid and data source. It is a client only data source that is used to list all data sources. Here is the code that creates the data source. The HAS_FIELD_OVERRIDES field is the one with the problem.
      Code:
      	/**
      	 * Build a client only data source for the list of all DataSources
      	 * @return The DataSource data source.
      	 */
      	private DataSource getDataSourceDataSource() {
      		DataSource ds = new DataSource();
      		ds.setClientOnly(true);
      		DataSourceField name = new DataSourceField(NAME, FieldType.TEXT);
      		DataSourceField title = new DataSourceField(TITLE, FieldType.TEXT);
      		DataSourceField hasFieldOverrides = new DataSourceField(HAS_FIELD_OVERRIDES, FieldType.BOOLEAN, "Customized?");
      		DataSourceField webServiceOperations = new DataSourceField(WEB_SERVICE_OPERATIONS, FieldType.TEXT, "Web Services");
      		DataSourceField notes = new DataSourceField(NOTES, FieldType.TEXT);
      		notes.setDetail(true);
      		notes.setLength(4000);
      		ds.setFields(name, title, hasFieldOverrides, webServiceOperations, notes);
      		name.setPrimaryKey(true);
      		return ds;
      	}
      Here is the code that creates the grid.
      Code:
      		if (dataSourceGrid==null) {
      			dataSourceGrid = new IpListGrid(DATA_SOURCE_EDITOR_DATA_SOURCE_GRID);
      			dataSourceGrid.setWidth100();
      			dataSourceGrid.setHeight100();
      			dataSourceGrid.setAutoFetchData(true);
      			dataSourceGrid.setDataSource(getDataSourceDataSource());
      			dataSourceGrid.setSortField(NAME);
      			dataSourceGrid.setShowFilterEditor(true);
      			dataSourceGrid.setAllowFilterExpressions(true);
      			dataSourceGrid.setFilterOnKeypress(true);
      			dataSourceGrid.setCanHover(true);
      			dataSourceGrid.setHoverMoveWithMouse(true);
      			dataSourceGrid.setHoverCustomizer(new HoverCustomizer() {		
      				@Override
      				public String hoverHTML(Object value, ListGridRecord record, int rowNum,
      						int colNum) {
      					return record.getAttribute(NOTES);
      				}
      			});		
      			dataSourceGrid.loadGridSettingsForCurrentUser();
      			dataSourceGrid.addRecordClickHandler(new RecordClickHandler() {
      
      				@Override
      				public void onRecordClick(final RecordClickEvent event) {
      					if (fieldsGrid.hasChanges()) {
      						SC.confirm("Discard pending field overrides?", new BooleanCallback() {
      
      							@Override
      							public void execute(Boolean value) {
      								if (value) {
      									dsName = event.getRecord().getAttribute(NAME);
      									editDataSource();
      								}
      								else
      									dataSourceGrid.selectRecord(event.getRecordNum());
      							}
      						});
      					}
      					else {
      						dsName = event.getRecord().getAttribute(NAME);
      						editDataSource();
      					}
      				}
      			});
      			dataSourceGrid.getDataSource().setTestData(getDataSourceRecords());
      		}
      		return dataSourceGrid;	}
      [code]
      	/**
      	 * Return a list of all data sources from the IslandPacificDSConstants array.
      	 * @return A list of all data sources from the IslandPacificDSConstants array.
      	 */
      	private ListGridRecord[] getDataSourceRecords() {
      		ListGridRecord[] records = new ListGridRecord[IslandPacificDSConstants.DATA_SOURCES.length];
      		for (int i=0; i<IslandPacificDSConstants.DATA_SOURCES.length; i++) {
      			String dsName = IslandPacificDSConstants.DATA_SOURCES[i];
      			DataSource ds = DataSource.get(dsName);
      			ListGridRecord rec = new ListGridRecord();
      			rec.setAttribute(NAME, dsName);
      			rec.setAttribute(TITLE, ds.getTitle());
      			rec.setAttribute(WEB_SERVICE_OPERATIONS, ds.getAttribute(WEB_SERVICE_OPERATIONS));
      			rec.setAttribute(HAS_FIELD_OVERRIDES, ds.getAttribute(HAS_FIELD_OVERRIDES));
      			records[i] = rec;
      		}
      		return records;
      	}
      [/code]

      Comment


        #4
        We see the problem - we'll let you know when we have it resolved.

        Comment


          #5
          Thanks for the report, this is fixed and should be available in nightlies from today.

          Comment

          Working...
          X