Announcement

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

    Bug in Filter and Editing Highlights in Advanced Highlight Editor in Listgrid

    Hi,

    Please review the sample code provided.

    Code:
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.data.DataSource;
    import com.smartgwt.client.data.Record;
    import com.smartgwt.client.data.fields.DataSourceDateField;
    import com.smartgwt.client.data.fields.DataSourceTextField;
    import com.smartgwt.client.widgets.IButton;
    import com.smartgwt.client.widgets.events.ClickEvent;
    import com.smartgwt.client.widgets.events.ClickHandler;
    import com.smartgwt.client.widgets.grid.ListGrid;
    import com.smartgwt.client.widgets.grid.ListGridField;
    import com.smartgwt.client.widgets.grid.ListGridRecord;
    import com.smartgwt.client.widgets.layout.VLayout;
    
    public class ListgridHiliteExample implements EntryPoint {
    
        @Override
        public void onModuleLoad() {
            VLayout layout = new VLayout(0);
            layout.setWidth100();
            layout.setHeight100();
    
            // Define the DataSource
            DataSource dataSource = new DataSource();
            dataSource.setClientOnly(true); // Client-side only DataSource
    
            DataSourceTextField idField = new DataSourceTextField("id", "ID");
            DataSourceTextField nameField = new DataSourceTextField("name", "Name");
            DataSourceDateField independenceField = new DataSourceDateField("date", "Date");
            DataSourceTextField ageField = new DataSourceTextField("age", "Age");
    
            dataSource.setTestData(new Record[] { getData("1", "John Doe", "2024-05-10", "25"),
                    getData("2", "Jane Smith", "2024-05-10", "30"), getData("3", "Jatin Garala", "2024-05-10", "40") });
    
            dataSource.setFields(idField, nameField, independenceField, ageField);
    
            // Define the ListGrid
            ListGrid listGrid = new ListGrid();
            listGrid.setWidth(500);
            listGrid.setHeight(300);
            listGrid.setShowFilterEditor(true);
    
            listGrid.setDataSource(dataSource);
            listGrid.setAutoFetchData(true);
    
            ListGridField idListField = new ListGridField("id", "ID");
            idListField.setCanFilter(false);
            ListGridField nameListField = new ListGridField("name", "Name");
            nameListField.setCanFilter(true);
            ListGridField dateListField = new ListGridField("date", "Date");
            dateListField.setCanFilter(false);
            ListGridField ageListField = new ListGridField("age", "Age");
            ageListField.setCanFilter(false);
    
            IButton editHilitesButton = new IButton("Edit Hilites");
            editHilitesButton.setAutoFit(true);
            editHilitesButton.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    final String hiliteStr = listGrid.getHiliteState();
                    if(hiliteStr!=null && !hiliteStr.isEmpty())
                    {
                        listGrid.setHiliteState(hiliteStr);
                        listGrid.editHilites();
                    }
                    else
                    {
                        listGrid.editHilites();
                    }
    
                }
            });
    
            listGrid.setFields(idListField, nameListField, dateListField, ageListField);
    
            layout.addMember(editHilitesButton);
            layout.addMember(listGrid);
            layout.draw();
    
        }
    
        public Record getData(String id, String name, String date, String age) {
    
            Record record = new ListGridRecord();
            record.setAttribute("id", id);
            record.setAttribute("name", name);
            record.setAttribute("date", date);
            record.setAttribute("age", age);
            return record;
        }
    
    }



    I have encountered issues while attempting to edit existing highlights in the ListGrid. Specifically, there seems to be a bug in the filter functionality within the Advanced Highlight Editor.

    Test case:

    1. Click the Edit Highlights button.
    2. Select the Name field from the Available Fields list.
    3. Set the Text and Background colors for the Name field where the value is "Jatin" and save.
    4. Click the Edit Highlights button again.
    5. In the opened window, Edit Existing Highlights.
    6. The Advanced Highlight Editor window will open.
    7. In the Filter group, you will notice that only the Name field appears in the dropdown, and no other ListGrid fields are available.

    I am unable to select the Date or Age fields and set highlights on the Name field.

    The issue arises because, when I set setCanFilter(true) on the Name field, only this field appears in the dropdown. For all other fields, I’ve set setCanFilter(false), so they don't appear.

    I want to set setCanFilter(true) only for the Name field, and keep it false for all other fields.


    Additionally, I encountered another bug: when editing highlights in the Filter group, the "Contains" option is always selected, even when you choose "One of" for the highlights.

    I have attached all relevant screenshots with this post.

    I’m using SmartGWT 13.1 LGPL Edition on the latest version of Chrome.

    Thank you!

    Attached Files

    #2
    Could you clarify:

    1) first issue: you seem to be trying to create hilites that change the appearance of the Name field, by using criteria on Date or Age. However, it is expected that this is not allowed, because if filtering is not allowed for these filters, hilites cannot be used since hilites require filtering

    2) second issue: it seems like you are saying you used the "is one of" search operator, then saved the hilite, then when you re-opened the editor, it was showing "contains" as the operator instead?

    Comment


      #3
      Hello,

      Thank you for your quick response.

      1. To clarify, I don’t want to enable filtering on all the fields in the ListGrid. So, I’ve set setCanFilter(false) on fields like Date and Age. However, I’ve noticed that when I set setCanFilter(null) for certain fields, such as:

      Code:
              ListGridField idListField = new ListGridField("id", "ID");
              idListField.setCanFilter(null);
              ListGridField nameListField = new ListGridField("name", "Name");
              nameListField.setCanFilter(true);
              ListGridField dateListField = new ListGridField("date", "Date");
              dateListField.setCanFilter(null);
              ListGridField ageListField = new ListGridField("age", "Age");
              ageListField.setCanFilter(null);
      The above code is works as expected, but The issue is that I can see all the fields with filtering enabled. even though I only want the filter to be enabled for the "Name" column.

      Please see the attached image for reference.

      Is there a way to ensure that only the filter appears for the "Name" column and the others are completely hidden or disabled?

      Is there a way to make sure that only the filter for the "Name" column is visible, while hiding or disabling all other columns? Additionally, I would like to enable all the fields show in the Advanced Highlight Editor.

      2. Yes.


      Thank you
      Attached Files

      Comment


        #4
        1) still not clear. You are saying that you want filtering disabled for those fields, but then you are reporting as a bug that filtering is disabled for those fields in the HiliteEditor. But this is expected - the system is doing exactly what you told it to do.

        2) we'll check on this

        Comment


          #5
          Hi,

          I’ve attached a image for comparison. Please take a look.

          The first part of the image shows SmartGWT 13.0 (the earlier stable version), where the "Edit Highlight" rule can be modified directly in the same window without opening the advanced Highlight Editor. As a result, there is no issue with filters.

          The second part of image shows SmartGWT 13.1 (the latest stable version), where the "Edit Highlight" rule always opens in the advanced Highlight Editor window.


          I’m facing an issue with my current project and would like to know if there’s a way to revert to the previous "Edit Highlight" functionality, similar to what was available in SmartGWT 13.0.
          Attached Files

          Comment


            #6
            Thanks for the report.

            We've fixed both issues you reported - incorrectly showing advanced HiliteRules for simple Hilites and broken isOneOf handling with text-fields.

            We also corrected a few cosmetic things - padding, sizing, scaling and styling for the text and icons in the Advanced HiliteRules.

            Please retest with a build dated March 9 or later.

            Comment


              #7
              Hi,

              Thank you for your assistance.

              I have downloaded both the latest SmartGWT 13.1 LGPL and the SmartGWT pre-release 15.0 LGPL versions. However, I am still encountering the same issue with Advanced HiliteRules being applied instead of simple Hilites.

              Could you please confirm which version was updated with the build from March 9th?

              Thank you for your help.

              Comment


                #8
                Hi,

                if you don’t want to check developer console or inside jar files in the download, you can see the date of the latest build in the download folders:
                https://smartclient.com/builds/index.jsp

                Best regards
                Blama

                Comment


                  #9
                  It looks like these changes didn't make the build-queue in time. Please check today's build when it arrives.

                  Comment


                    #10
                    Thank you Blama & @Isomorphic for your support, it is working fine now.

                    Comment

                    Working...
                    X