Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

Can you specify substring matching for a combobox filter editor in ds.xml?

$
0
0
I have tested this in the following releases and get the same behavior
v9.0p_2013-10-10/PowerEdition
v9.0p_2014-01-29/PowerEdition

We are using SmartGWT 4.0p from the above build dates.

I have a listgrid that is created without specifying any fields in java code. All fields are specified in the ds.xml only.

A few of the fields are foreign key references into other tables and I have those fields configured to use a combobox in the filter editor. Here is one of the field definitions

Code:

<field name="buyer" includeFrom="abbuyer.buyer_display" title="Buyer"
 optionDataSource="abbuyer" valueField="buyer_display"
 editorType="ComboBoxItem" optionTextMatchStyle="substring"/>

When typing a string in the filter editor for that field, the listgrid will correctly filter down the results using a substring match. The filter editor however is performing a startswith search against the possible field values, so the combobox will display "No Items to show". If I type the beginning of a value in the filter editor, the combobox correctly filters down the possible values.

I've attached a screenshot that shows the listgrid filtered properly, with the filter editor showing no matches.

How can I modify the ds.xml file to perform a substring match in the filter editor?

Is the ListGridField javadoc the best place to look for attributes for configuring <field/> elements in the ds.xml?

Here is the code used to create the ListGrid. This is used to create several ListGrids to be used as admin interfaces into tables, so we don't want to specify any fields in java code.
Code:

                DataSource ds = DataSource.get(dataSourceName);

                final ListGrid grid = new ListGrid();
                grid.setDataSource(ds);
                grid.setAutoFetchData(true);
                grid.setCanEdit(true);
                grid.setCanRemoveRecords(true);
                grid.setModalEditing(true);

        grid.setShowFilterEditor(true);
        grid.setFilterOnKeypress(true);
        grid.setFetchDelay(500);

        grid.setMinFieldWidth(65);

            // Create grid footer (toolstrip) for add button
                ToolStrip footer = new ToolStrip();
                footer.setMembersMargin(3);
                footer.setWidth100();
                footer.setHeight(24);

                LayoutSpacer spacer = new LayoutSpacer();
                spacer.setWidth("*");
                footer.addMember(spacer);

                final ToolStripButton addButton = new ToolStripButton("Add Record", "[SKIN]/actions/add.png");
                addButton.addClickHandler(new ClickHandler() {
                        @Override
                        public void onClick(ClickEvent event) {
                                grid.startEditingNew();
                        }
                });
                footer.addMember(addButton);

                grid.setGridComponents(ListGridComponent.FILTER_EDITOR, ListGridComponent.HEADER, ListGridComponent.BODY, ListGridComponent.SUMMARY_ROW, footer);

                return grid;


Attached Images
File Type: jpg Screen Shot 2014-02-06 at 3.34.44 PM.jpg (75.1 KB)

Viewing all articles
Browse latest Browse all 4756

Trending Articles