So I'm able to get the current canvas and loop through the getChildren() canvases to find the one returned by getTarget. When i find the canvas in the getChildren() list, I store the index. With that index, I find the record from the recordList return from calling the TileGrid.getDataAsRecordList().
The problem that i'm experiencing is that the record is off by 1. Meaning i'm getting a canvas index, and when i look at the RecordList its not the correct index.
This makes me wonder how do I garentee that the index is the same or even if the two List that return for Canvus or RecordList is the same size. Is there cases where one List will contain more or list.
Is the sytleName for each canvase Tile always set to "simpleTileOver". I notice that in the dubbugger:
Here is the code:
Code:
public void onMouseOver(MouseOverEvent event) {
// TODO Auto-generated method stub
Canvas tile_canvas = (Canvas)EventHandler.getTarget();
Canvas [] tileCanvases = tileGrid.getChildren();
for (int i = 0; i < tileCanvases.length; i++)
{
Canvas tile = tileCanvases[i];
if(tile.getID().equals(tile_canvas.getID()))
{
RecordList recordList = tileGrid.getDataAsRecordList();
String json = JSON.encode(recordList.get(i).getJsObj());
SC.logWarn(json);
}
}
}
Any advice Appreciated
D
Leave a comment: