voyent
Messages posted by: christianpitzer  XML
Profile for christianpitzer -> Messages posted by christianpitzer [5]
Author Message
Work Around Solution found and build:

Firstly describe more around the bug:
=======================
Fundamental bug is there. When Filter Is used on <ace:dataTable> The rowIndexVar does not align with data source anymore. The DragDropEvent Also does not pass the correct data reference..it mostly passes the full DataSource and index is not aligned. As previous comment show the rowIndex Obtained in the DragDropRenderer is incorrect.

dropPanelListenerSlot1(DragDropEvent dragEvent) {

This issued then gets the incorrect DataRow from the DragDropEvent dragEvent.getData()


Work Around Solution:
Step 1: On the Draggable ace:dataTable
---------------------------------------------
Set rowIndexVar="dragItem"

Step 2: On the Draggable ace:dataTable
---------------------------------------------
On the Draggable Column. Please also note I had to use another dependency injected bean scoped @ViewScoped[arenaSportTeamScheduleController]. So it is a different bean that I used for my dataTable as I want my dataTable to refresh one every request so not to lose my property value before I dropped as the first request is fired on drag @RequestScoped

<ace:draggable revert="true" opacity="0.5"
scope="#draggableItem.type}" snap="true"
snapMode="inner" helper="clone">
<ace:ajax listener=
"#arenaSportTeamScheduleController.passRowIndexVar(draggableItem)}">
</ace:ajax>
</ace:draggable>

}


Step 3:
@Named("arenaSportTeamScheduleController")
@ViewScoped
public class ArenaSportTeamScheduleController implements Serializable {
....
/* Inject a DragDropItem Instance so we can use it in droppable */
private DragDropItem currDraggableTeamId;
...
...getters()
...setters()

Step 4:
Back to my dataTable Bean

public void dropPanelListenerSlot1(DragDropEvent dragEvent) {
....
FacesContext facesContext = FacesContext.getCurrentInstance();

UIComponent component = dragEvent.getComponent();
Droppable droppable = (Droppable) component;

String datasourceId = droppable.getDatasource();

if(datasourceId != null) {
UIData datasource = findDatasource(facesContext, droppable, datasourceId);
for (int i = -1; i < datasource.getRowCount(); i++) {
datasource.setRowIndex(i);
Object data = datasource.getRowData();
item = null;
item = (DragDropItem) data;

if (item.getId().equals(arenaSportTeamScheduleController.getCurrDraggableTeamId().getId()) && item.getGameNumber() == arenaSportTeamScheduleController.getCurrDraggableTeamId().getGameNumber()) break;

}


}
follow up: I have used your code embedded into mine to try to determine what exactly goes wrong

The Index that gets returned is the relative position of what is currently displayed in the dataTable
This Portion :
int rowIndex;
try {
rowIndex = Integer.parseInt(idTokens[idTokens.length - 2]);
} catch(Exception e) {
rowIndex = -1;
}

But the datasource portion contains all the data in the full data list.(Not the filtered records only)

So when the setRowIndex is set to position 2.
It will get the the data element index of the total data list position 2 and not the data that is currently filtered in the display.
So the below line gets Data Table full dataset. Which is then incorrect.
Or the index need to be retrieved of the relative position in the full set.
UIData datasource = findDatasource(context, droppable, datasourceId);

So Hope this explains. Definitely a bug when filtering on Data Table and then
using the DragDropEvent Event:
So I am sure this is a bug in the :http://anonsvn.icesoft.org/repo/icefaces4/trunk/icefaces/ace/component/src/org/icefaces/ace/component/dnd/DroppableRenderer.java

I have tried to override the hash / Equals...But I noted it was done before anyway.

Don't think it would help anyway as the rowIndex and relation to data record is wrong anyway.

I have tried so far to get around this. with no luck. Not sure if I had the FacesContext exposed directly in the DropEvent if I would have been able the get the current dragable items details out of that.
Thanks a mill:-) for replying and looking at this.
Would be awesome if this can be working in future...would open a lot of doors
how this datatable can be used.
seems like my only last major bug...lol

Considered going thought your libs code...and maybe I will. But my Jquery and Java Script knowledge still a bit limited...

I will need to work through your suggested solution. Not understanding it yet...
But will read up first.

ok about 95% sure I found where your bug is.
I am trying to override it on my side with what I can extract out of the DragDropEvent.

Think the bug is in your DroppableRenderer:
http://anonsvn.icesoft.org/repo/icefaces4/trunk/icefaces/ace/component/src/org/icefaces/ace/component/dnd/DroppableRenderer.java


Your Development team can evaluate this portion:
Think this rowIndex is not picking the correct rowIndex.
When dropping from a List


int rowIndex;
try {
rowIndex = Integer.parseInt(idTokens[idTokens.length - 2]);
} catch(Exception e) {
rowIndex = -1;
}
datasource.setRowIndex(rowIndex);
Object data = datasource.getRowData();
datasource.setRowIndex(-1);
ace:dataTable with filterBy into droppable ace:dataTable filter mess up index from sourceData.

Asume it is an internal bug using the dataTable dragable with filter option to not keep the correct index data item in new position after filter :ace:dataTable with filterBy


When I drag a item from source sortingList to another table with droppable
if works 100% if I am not using the filter from source table.
If I use the filter in Source dataTable when I drop my:(DragDropEvent
Pick Up the First Data Item in original list assume index 1 as before Sort:

public void dropPanelListener(DragDropEvent dragEvent) {

item = (DragDropItem) dragEvent.getData();



Draggable Table Data Side:
<ace:dataTable id="sortingList"
value="#{dragDropBean.teams}"
var="draggableItem"
style="width:1600;"
paginator="true"
scrollable="true"
scrollHeight="6000"
paginatorPosition="bottom"
rows="40"
styleClass="borderless"
emptyMessage="Filter Select No!"
>

Droppable Table Side:

<ace:dataTable id="setCourt1Slot1Drop1Item"
value="#{dragDropBean.court1Slot1Drop1Items}"
var="court1Slot1Drop1Items"
style="margin-left: -8px;margin-top:8px;width:1600;"
styleClass="borderless"
emptyMessage="Open Slot!"
>
>
>
 
Profile for christianpitzer -> Messages posted by christianpitzer [5]
Go to:   
Powered by JForum 2.1.7ice © JForum Team