I slightly changed the Simple Select Sample in this way...
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)
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(); }
If I select another row, the SelectionChanged is called four times.
SmartClient Version v12.1p_2022-11-02/Pro Deployment (2022-11-02)
Comment