Announcement

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

    ListGrid Filter does not ignore Upper and Lower Case

    Hello,

    I do not know if it is a feature or a bug in latest 4.1d. Since I am using this version the listGrid filter does not ignore the upper and lower case search. I need to enter the search term with correct upper and lower cases.

    Thanks for your help.

    best regards
    Andy



    Code:
    listGrid = new ListGrid();
            listGrid.setDataSource( getDataSource() );
            listGrid.setShowFilterEditor( true );
            listGrid.setAutoFetchData( true );
            listGrid.setEmptyCellValue( "---" );
            listGrid.setAutoFitFieldsFillViewport( true );
    
    ListGridField displayField =
                    new ListGridField( CItemSupplyEmails.display_name, constants.listGridEmailsSenderName() );
                displayField.setWidth( "20%" );
    
                ListGridField senderField =
                    new ListGridField( CItemSupplyEmails.sender_adress, constants.listGridEmailsSenderAddress() );
                senderField.setWidth( "20%" );
    
                ListGridField headlineField =
                    new ListGridField( CItemSupplyEmails.headline, constants.listGridEmailsSubject() );
                headlineField.setWidth( "35%" );
    
                ListGridField statusField = new ListGridField( CItemSupplyEmails.status, constants.listGridEmailsStatus() );
                statusField.setWidth( "5%" );
                statusField.setAlign( Alignment.CENTER );
                statusField.setCellFormatter( new CellFormatter()
                {
                    public String format( Object value, ListGridRecord record, int rowNum, int colNum )
                    {
                        if ( value == null )
                            return null;
                        try
                        {
                            String[] split = String.valueOf( value ).split( "/" );
    
                            if ( split[0].equals( split[1] ) )
                            {
                                return "<font color = 'green'> " + value.toString() + "</font>";
                            }
                            else if ( String.valueOf( value ).toLowerCase().trim().equals( "warten" )
                                || String.valueOf( value ).toLowerCase().trim().equals( "waiting" )
                                || Integer.valueOf( split[0] ) < Integer.valueOf( split[1] ) )
                            {
                                return "<font color = 'orange'> " + value.toString() + "</font>";
                            }
                            else
                            {
                                return "<font color = 'red'> " + value.toString() + "</font>";
                            }
    
                        }
                        catch ( Exception e )
                        {
                            return "<font color = 'red'> " + value.toString() + "</font>";
                        }
                    }
                } );
    
                ListGridField attachmentsField =
                    new ListGridField( CItemSupplyEmails.attachments, constants.listGridEmailsAttachments() );
                attachmentsField.setWidth( "5%" );
                attachmentsField.setAlign( Alignment.CENTER );
    
                ListGridField creatorField =
                    new ListGridField( CItemSupplyEmails.creator, constants.listGridEmailsSender() );
                creatorField.setWidth( "10%" );
    
                ListGridField createDateField =
                    new ListGridField( CItemSupplyEmails.creation_date, constants.listGridEmailsSendedDate() );
                createDateField.setWidth( "10%" );
                createDateField.setAlign( Alignment.LEFT );
    
                listGrid.setFields( displayField, senderField, headlineField, statusField, attachmentsField, creatorField,
                                    createDateField );

    #2
    Hi,

    I don't know if the behaviour changed, but see

    http://www.smartclient.com/smartgwte...ang.Boolean%29

    and

    http://www.smartclient.com/smartgwte....OperatorId%29

    and

    http://www.smartclient.com/smartgwte...TextMatchStyle

    for information.

    Best regards,
    Blama

    Comment


      #3
      thanks for your help... I found this method, But it does not work

      Code:
      listGrid.setAutoFetchTextMatchStyle( TextMatchStyle.SUBSTRING );

      Comment


        #4
        Try the others as well. Field-level overrides Grid-level.

        Comment


          #5
          Thanks for your help but on field level I just can call:

          Code:
          listGridField.setAutoFetchTextMatchStyle( true );
          This doesn't change a single thing. So does anyone have an idea or a working solution?

          Thanks
          Andy

          Comment


            #6
            Please click the 2nd link. It links to ListGridField.setFilterOperator(OperatorId filterOperator)

            Additionally, in the JavaDocs, there is no ListGridField.setAutoFetchTextMatchStyle(...)

            Comment


              #7
              Hey thanks again... the following code seems to work:

              Code:
              ListGridField.setFilterOperator( OperatorId.ICONTAINS );
              But isn't there an easier way... this means that I need to add this line to each Column. I have a couple of tables in my application.

              Thanks
              Andy

              Comment


                #8
                Please click the 3rd link.

                Comment


                  #9
                  sorry but I can not follow you... I only found 2 working solutions:

                  1. listGrid.setAllowFilterExpressions( false );
                  2. ListGridField.setFilterOperator( OperatorId.ICONTAINS );

                  Solution one is not a real one because I need to disable the filter expressions
                  Solution two is working, but I need to add many code lines for all tables columns

                  The following also did not not worked:
                  listGrid.setFilterEditorCriteria( new Criterion( OperatorId.ICONTAINS ) );
                  Last edited by andyx1975; 21 Feb 2014, 14:40.

                  Comment


                    #10
                    Originally posted by andyx1975 View Post
                    sorry but I can not The following also did not not worked:
                    listGrid.setFilterEditorCriteria( new Criterion( OperatorId.ICONTAINS ) );
                    That's definitely not what you are looking for.

                    Please see my 3rd link in the post 20th Feb 2014, 02:50 and add the attribute to your .ds.xml file.

                    Best regards,
                    Blama

                    Comment


                      #11
                      sorry did not mention this... I also tried:

                      Code:
                      datasource.setDefaultTextMatchStyle( TextMatchStyle.SUBSTRING );
                      No success :-( So I guess it is a bug in ListGrids???

                      Comment


                        #12
                        Hi andyx1975,

                        then please create a minimal testcase for Isomorphic. Should be as easy as adding a filterRow to the BuiltInDS sample or referencing a sample from the showcase and the generated request in Console and what you expected.
                        It's also great if you can tell the date the behaviour changed.

                        Best regards,
                        Blama

                        Comment


                          #13
                          ok... thank you... that's not a big deal... expect it soon. Thank you!!!

                          Comment


                            #14
                            So I created an example... as soon as I use the method "listGrid.setAllowFilterExpressions( true );", the incase filter search does not work anymore... you need to enter the correct Upper and Lower cases. As soon as I remove the method "listGrid.setAllowFilterExpressions( true );" it is working as expected. So I guess it is maybe a bug?


                            here's the code:

                            List Grid:
                            Code:
                            package com.uds.webadmin.client;
                            
                            import com.smartgwt.client.data.Criteria;
                            import com.smartgwt.client.data.DataSource;
                            import com.smartgwt.client.data.Record;
                            import com.smartgwt.client.widgets.Canvas;
                            import com.smartgwt.client.widgets.grid.ListGrid;
                            import com.smartgwt.client.widgets.grid.ListGridField;
                            import com.smartgwt.client.widgets.viewer.DetailViewer;
                            
                            public class ItemListGrid
                            {
                                final DataSource dataSource = ItemSupplyXmlDS.getInstance();
                            
                                public void initListGrid()
                                {
                                    ListGrid listGrid = new ListGrid()
                                    {
                                        @Override
                                        protected Canvas getCellHoverComponent( Record record, Integer rowNum, Integer colNum )
                                        {
                                            DetailViewer detailViewer = new DetailViewer();
                                            detailViewer.setWidth( 200 );
                                            detailViewer.setDataSource( dataSource );
                                            Criteria criteria = new Criteria();
                                            criteria.addCriteria( "itemID", record.getAttribute( "itemID" ) );
                                            detailViewer.fetchData( criteria );
                            
                                            return detailViewer;
                                        }
                                    };
                                    
                                    ListGridField itemNameField = new ListGridField("itemName");  
                                    ListGridField skuField = new ListGridField("SKU");  
                                    ListGridField categoryField = new ListGridField("category");  
                                    listGrid.setFields(itemNameField, skuField, categoryField);  
                                    
                                    listGrid.setDataSource( dataSource );
                                    listGrid.setEmptyCellValue( "---" );
                                    listGrid.setAutoFetchData( true );
                                    listGrid.setShowFilterEditor( true );
                                    listGrid.setAutoFitFieldsFillViewport( true );
                                    listGrid.setAllowFilterExpressions( true );
                                }
                                
                                
                            }

                            DataSource:
                            Code:
                            package com.uds.webadmin.client;
                            
                            import com.google.gwt.core.client.GWT;
                            import com.smartgwt.client.data.DataSource;
                            import com.smartgwt.client.data.fields.DataSourceBooleanField;
                            import com.smartgwt.client.data.fields.DataSourceDateField;
                            import com.smartgwt.client.data.fields.DataSourceIntegerField;
                            import com.smartgwt.client.data.fields.DataSourceTextField;
                            import com.smartgwt.client.types.DateDisplayFormat;
                            import com.smartgwt.client.widgets.grid.ListGridField;
                            
                            public class ItemSupplyXmlDS
                                extends DataSource
                            {
                            
                              
                                
                                private static ItemSupplyXmlDS instance = null;
                                public static ItemSupplyXmlDS getInstance()
                                {
                                    if ( instance == null )
                                    {
                                        instance = new ItemSupplyXmlDS( "ItemSupplyXmlDS" );
                                    }
                                   
                                    return instance;
                                }
                            
                                public ItemSupplyXmlDS( String id )
                                {
                            
                                    String dataUrl = GWT.getHostPageBaseURL() + "rest/basedata/get/ItemSupplyXmlDS";
                                    setRecordXPath( "/xmlDSs/xmlDS" );
                                    setDataURL( dataUrl );
                            
                                    setID( id );
                            
                                    DataSourceTextField itemNameField = new DataSourceTextField("itemName", "Item", 128, true);  
                                    DataSourceTextField skuField = new DataSourceTextField("SKU", "SKU", 10, true);  
                                    DataSourceTextField descriptionField = new DataSourceTextField("description", "Description", 2000);  
                                    DataSourceTextField categoryField = new DataSourceTextField("category", "Category", 128, true);  
                              
                                    DataSourceIntegerField pkField = new DataSourceIntegerField("itemID");  
                                    pkField.setHidden(true);  
                                    pkField.setPrimaryKey(true);  
                             
                                    setClientOnly( true );
                                    
                                    setFields(pkField, itemNameField, skuField, descriptionField, categoryField);  
                             
                                }
                            }

                            Comment


                              #15
                              Hello,
                              We've fixed this issue - please pick up the next nightly build (dated March 2 or later) to get this fix.

                              Regards
                              Isomorphic Software

                              Comment

                              Working...
                              X