Announcement

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

    ListGrid SelectionChangedHandler bug

    I slightly changed the Simple Select Sample in this way...

    Code:
           public class SimpleSelectSample implements EntryPoint {  
    Canvas canvas = new Canvas();
    
            final ListGrid selectedCountriesGrid = new ListGrid();
            selectedCountriesGrid.setWidth(250);
            selectedCountriesGrid.setHeight(100);
            selectedCountriesGrid.setTop(250);
            selectedCountriesGrid.setShowAllRecords(true);
            ListGridField selectedCountriesField = new ListGridField("countryName", "Selected Countries");
            selectedCountriesGrid.setFields(selectedCountriesField);
    
            final ListGrid countryGrid = new ListGrid();
            countryGrid.setWidth(500);
            countryGrid.setHeight(224);
            countryGrid.setShowAllRecords(true);
            countryGrid.setSelectionType(SelectionStyle.SIMPLE);
    
            ListGridField countryCodeField = new ListGridField("countryCode", "Flag", 40);
            countryCodeField.setAlign(Alignment.CENTER);
            countryCodeField.setType(ListGridFieldType.IMAGE);
            countryCodeField.setImageURLPrefix("flags/16/");
            countryCodeField.setImageURLSuffix(".png");
    
            ListGridField nameField = new ListGridField("countryName", "Country");
    ---------------------------------------------------------
            nameField.setFrozen(true);
    ---------------------------------------------------------
            ListGridField capitalField = new ListGridField("capital", "Capital");
            ListGridField continentField = new ListGridField("continent", "Continent");
            countryGrid.setFields(countryCodeField, nameField, capitalField, continentField);
    
            countryGrid.setData(CountrySampleData.getRecords());
            countryGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
                public void onSelectionChanged(SelectionEvent event) {
                    selectedCountriesGrid.setData(countryGrid.getSelection());
                }
            });
    
            canvas.addChild(countryGrid);
            canvas.addChild(selectedCountriesGrid);
    
            canvas.draw();
        }
    And now, when I select a row for the first time, the SelectionChanged event handler is called twice
    If I select another row, the SelectionChanged is called four times.

    SmartClient Version v12.1p_2022-11-02/Pro Deployment (2022-11-02)
    Last edited by Hirn; 21 Apr 2023, 06:07.

    #2
    The same thing happens if you add such code to the Timeline example...

    Code:
    ListGridField titleField = new ListGridField("title");
    
            ListGrid tasksLineProps = new ListGrid();
            tasksLineProps.setCanSort(false);
            tasksLineProps.setSelectionType(SelectionStyle.SINGLE);
            tasksLineProps.setShowSelectedStyle(true);
            tasksLineProps.setFields(titleField);
    
            tasksLineProps.addSelectionChangedHandler(new SelectionChangedHandler() {
                @Override
                public void onSelectionChanged(SelectionEvent event) {
    ----
    ----
                }
            });
    
    Timeline calendar = new Timeline();
    calendar.setAutoChildProperties("timelineView", tasksLineProps);
    ---
    ---

    Comment


      #3
      Thanks for the notification and the additional information.
      We've made a change to the framework to address this problem. Please try the next nightly build, dated May 19 2023 or above

      Regards
      Isomorphic Software

      Comment

      Working...
      X