문제

I have a CellList in GWT, i need to deselect the cell when one link is clicked without using the selectionchange handler.Can someone help in this situation.

CellList<MyClass> cellList;    
SingleSelectionModel<MyClass> lSelectionModel;

final SingleSelectionModel<MyClass> lSelectionModel = 
    new SingleSelectionModel<MyClass>();
this.cellList.setSelectionModel(lSelectionModel);

public void setSelected(final MyClass pClass) {

        Anchor lLink = new Anchor();
        lLink.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent pEvent) {
        //Here i need to deselect the cell(Myclass)

            }
        });

}

Thanks in advance,

Raj

도움이 되었습니까?

해결책

Using a SingleSelectionModel, is as easy as:

lLink.addClickHandler(new ClickHandler() {
  @Override
  public void onClick(ClickEvent pEvent) {
    MyClass selected = lSelectionModel.getSelectedObject();
    if (selected != null) {
      lSelectionModel.setSelected(selected, false); 
    }
});
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top