PDA

View Full Version : List multiselection problem



werum2011
8 Mar 2012, 11:41 PM
Hi,
i have a problem to select multiple items from a list (Only with Internet Explorer).
To reproduce this problem go to the sencha examples:
http://www.sencha.com/examples/explorer.html#listtolist (http://www.sencha.com/examples/explorer.html#listtolist)

Steps to do:
1.) Select an item
2.) Scroll down or up, so that the selected item is not visible (thats the important step, if the first item is visible while selecting another item, all works fine)
3.) Select another item (with pressed shift key)

-> All Items between the two selected items will selected automatically, but after a second all items were deselected.


Alex

werum2011
9 Mar 2012, 6:46 AM
a first workaround for multiselection.

juct copied the original method "handleMouseDown()" from the ListViewSelectionModel ...but without the "listView#focusItem(e.getIndex())" call


dualListField.getFromField().getListView().setSelectionModel(new ListViewSelectionModel<D>() {
@Override
protected void handleMouseDown(ListViewEvent<D> e) {
if (e.getIndex() == -1 || isLocked() || isInput(e.getTarget())) {
return;
}
if (e.isRightClick()) {
if (selectionMode != SelectionMode.SINGLE && isSelected(listStore.getAt(e.getIndex()))) {
return;
}
select(e.getIndex(), false);
// listView.focusItem(e.getIndex());
} else {
D sel = listStore.getAt(e.getIndex());
if (selectionMode == SelectionMode.SIMPLE) {
if (!isSelected(sel)) {
select(sel, true);
// listView.focusItem(e.getIndex());
}


} else if (selectionMode == SelectionMode.SINGLE) {
if (e.isControlKey() && isSelected(sel)) {
deselect(sel);
} else if (!isSelected(sel)) {
select(sel, false);
// listView.focusItem(e.getIndex());
}
} else if (!e.isControlKey()) {
if (e.isShiftKey() && lastSelected != null) {
int last = listStore.indexOf(lastSelected);
int index = e.getIndex();
select(last, index, e.isControlKey());
// listView.focusItem(last);
} else if (!isSelected(sel)) {
doSelect(Arrays.asList(sel), false, false);
// listView.focusItem(e.getIndex());
}
}
}
}
});


Alex