Hi
There is a bug in ListGrid when drag selecting multiple records. Object event.getSelection() returns wrong number of selected records. It is possible to see it when you for example drag select 3 records, then event.getSelection().length equals 2. When you drag select 2 records and then select 1 without releasing mouse button, then event.getSelection().length equals 2. I attach code to easy reproduce it. Please check it.
Thanks, Adam
I am using SmartGWT built 2012-03-10, FF 10
There is a bug in ListGrid when drag selecting multiple records. Object event.getSelection() returns wrong number of selected records. It is possible to see it when you for example drag select 3 records, then event.getSelection().length equals 2. When you drag select 2 records and then select 1 without releasing mouse button, then event.getSelection().length equals 2. I attach code to easy reproduce it. Please check it.
Thanks, Adam
I am using SmartGWT built 2012-03-10, FF 10
Code:
package org.yournamehere.client; import com.google.gwt.core.client.EntryPoint; import com.smartgwt.client.types.SelectionStyle; import com.smartgwt.client.widgets.Label; 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.grid.events.SelectionChangedHandler; import com.smartgwt.client.widgets.grid.events.SelectionEvent; import com.smartgwt.client.widgets.layout.VLayout; public class MainEntryPoint implements EntryPoint { ListGrid grid = new ListGrid(); Label label = new Label("0"); public void onModuleLoad() { grid.addSelectionChangedHandler(new SelectionChangedHandler() { public void onSelectionChanged(SelectionEvent event) { label.setContents(Integer.toString(event.getSelection().length)); } }); grid.setWidth(300); grid.setHeight(200); grid.setData(createRecords()); grid.setSelectionType(SelectionStyle.MULTIPLE); grid.setCanDragSelect(true); grid.setFields(new ListGridField("a")); VLayout layout = new VLayout(); layout.addMember(grid); layout.addMember(label); layout.draw(); } private ListGridRecord[] createRecords() { ListGridRecord[] result = new ListGridRecord[10]; for (int i = 0; i < result.length; i++) { result[i] = new ListGridRecord(); result[i].setAttribute("a", "a" + i); } return result; } }
Comment