Algiano
4 Apr 2009, 2:24 PM
Hi All,
I'm having a bit of a problem using a ListView and Drag & Drop to itself to work properly.
The ListView uses a store declared as:
store = new ListStore<BaseModel>(loader);
Note that the ListStore is being populated from an HttpProxy loading XML as it's data. This loads correctly as the XTemplate I'm using to display the data shows the correct data.
The ListView is created as follows:
//Initialise the ListView
listView = new ListView() {
@Override
public void onComponentEvent(ComponentEvent se) {
//Do stuff
super.onComponentEvent(se);
}
};
//Set the list view properties and config
listView.setStyleAttribute("overflow-Y", "auto");
listView.setStyleAttribute("padding", "0px");
listView.setStyleAttribute("border", "0px");
listView.setBorders(false);
listView.setLoadingText("Loading...");
listView.setStyleAttribute("backgroundColor", "white");
listView.setTemplate(template);
listView.setStore(store);
listView.setOverStyle("");
listView.setSelectStyle("");
listView.setItemSelector("div.my-container");
//listView.getSelectionModel().bindList(listView);
listView.getSelectionModel().setSelectionMode( SelectionMode.SINGLE );
The XTemplate contains the DIV with class name equal to my-container. This actually gets selected when using DND, it just doesn't allow you to place the selected item anywhere.
This is the DND code:
new ListViewDragSource(listView);
ListViewDropTarget listViewTarget = new ListViewDropTarget(listView);
listViewTarget.setAllowSelfAsSource(true);
listViewTarget.setFeedback(Feedback.INSERT);
//listViewTarget.setOperation(Operation.MOVE);
Any ideas why the ListView is letting me pick up the object but then gives me the little red symbol and doesn't allow me to drop the row anywhere?
Thanks,
Ale
I'm having a bit of a problem using a ListView and Drag & Drop to itself to work properly.
The ListView uses a store declared as:
store = new ListStore<BaseModel>(loader);
Note that the ListStore is being populated from an HttpProxy loading XML as it's data. This loads correctly as the XTemplate I'm using to display the data shows the correct data.
The ListView is created as follows:
//Initialise the ListView
listView = new ListView() {
@Override
public void onComponentEvent(ComponentEvent se) {
//Do stuff
super.onComponentEvent(se);
}
};
//Set the list view properties and config
listView.setStyleAttribute("overflow-Y", "auto");
listView.setStyleAttribute("padding", "0px");
listView.setStyleAttribute("border", "0px");
listView.setBorders(false);
listView.setLoadingText("Loading...");
listView.setStyleAttribute("backgroundColor", "white");
listView.setTemplate(template);
listView.setStore(store);
listView.setOverStyle("");
listView.setSelectStyle("");
listView.setItemSelector("div.my-container");
//listView.getSelectionModel().bindList(listView);
listView.getSelectionModel().setSelectionMode( SelectionMode.SINGLE );
The XTemplate contains the DIV with class name equal to my-container. This actually gets selected when using DND, it just doesn't allow you to place the selected item anywhere.
This is the DND code:
new ListViewDragSource(listView);
ListViewDropTarget listViewTarget = new ListViewDropTarget(listView);
listViewTarget.setAllowSelfAsSource(true);
listViewTarget.setFeedback(Feedback.INSERT);
//listViewTarget.setOperation(Operation.MOVE);
Any ideas why the ListView is letting me pick up the object but then gives me the little red symbol and doesn't allow me to drop the row anywhere?
Thanks,
Ale