I've tried creating a cell list based on the CwCellList example.
Unfortunately when I select an item in the cell list it always selects all
the items. Debugging into it, the code shows that in the
CellList.onBrowserEvent2, initially the target is the correct html td cell
selected. When it goes up the parent chain to find the idx:
while ((target != null)
&& ((idxString = target.getAttribute("__idx")).length() == 0)) {
target = target.getParentElement();
}
it goes all the way up to the div and finds idx = 0 even when the td was the
4th row for example. Thus the value picked is always the first one in the
list. Beyond that the selection visually shown encompasses all the rows (the
div is selected?).
Here's the code creating the cell list:
initWidget(uiBinder.createAndBindUi(this));
StepCell stepCell = new StepCell();
_cellList = new CellList<StepDO>(stepCell, StepDO.KEY_PROVIDER);
_cellList.setPageSize(30);
_cellList.setKeyboardPagingPolicy(KeyboardPagingPolicy.INCREASE_RANGE);
final SingleSelectionModel<StepDO> selectionModel = new
SingleSelectionModel<StepDO>(StepDO.KEY_PROVIDER);
_cellList.setSelectionModel(selectionModel);
selectionModel.addSelectionChangeHandler(new
SelectionChangeEvent.Handler()
{
@Override
public void onSelectionChange(SelectionChangeEvent event)
{
StepDO step =
((StepDO)((SingleSelectionModel<StepDO>)event.getSource()).getSelectedObject());
Window.alert(String.valueOf(step.getStepNumber()) + ". " +
step.getStepDescription() + " (" + step.getWorkflow() + ")");
}
});
WorkflowState state = new WorkflowState();
_dataProvider = new StepSource().generate(state );
_cellList.setRowCount(_dataProvider.getList().size(), true);
_dataProvider.addDataDisplay(_cellList);
stepPager.setDisplay(_cellList);
I am using GWT 2.1.0 with JDK1.6.0 r23 on 64bit Windows 7
Any clues to where I went wrong would be appreciated.
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.