Smartgwt listgrid set cursor to pass icon field

I worked on this problem for a long time, but I could not solve it. I have a listgrid with a field type icon. I would like to change the cursor to a “hand” above the icon.

I searched the Internet and saw that there are several solutions. One of them uses addCellOverHandlerto list grid. But I do not understand how you can change the cursor for the specified listgrid field.

this.addCellOverHandler(new CellOverHandler() {

    @Override
    public void onCellOver(CellOverEvent event) {
    // not able to get the field and setCursor()        
    }
});

My field in listgrid is defined as:

ListGridField iconField = new ListGridField("icon");
iconField.setAlign(Alignment.CENTER);
iconField.setType(ListGridFieldType.ICON);
iconField.setIcon("icons/icon.gif");

As someone pointed to the forum, there is a method setCursor()for listgrid, but not just for the field ...

If anyone has a key ... Thanks

+3
source share
4 answers

After a few more (much more ...) googling I found this:

http://forums.smartclient.com/showthread.php?t=15748

, getCellStyle listgrid. , :

@Override
protected String getCellStyle(ListGridRecord record, int rowNum, int colNum) {
    if (colNum==6){
        return "EC_pointer";
    }
    return super.getCellStyle(record, rowNum, colNum);
}

CSS:

.EC_pointer { 
    cursor: pointer; 
}

, .

+1

, SmartGwt2.4 Firefox 5.0.

demandesGrid.setCanHover(true);
demandesGrid.setShowHover(false);
demandesGrid.addCellHoverHandler(new CellHoverHandler() {
    @Override
    public void onCellHover(CellHoverEvent event) {
        if (event.getColNum() == demandesGrid.getFieldNum("icon")) {
        //  SC.say(demandesGrid.getChildren()[3].toString());
            demandesGrid.getChildren()[3].setCursor(Cursor.POINTER);
        } else {
            demandesGrid.getChildren()[3].setCursor(Cursor.DEFAULT);
        }
    }
});

, ListGridBody ; SC.say.

+2

grid.addCellOverHandler(new CellOverHandler() {
  @Override
  public void onCellOver(CellOverEvent event) {
    //cellOver event to get field and refresh the cell
    //grid.refreshCell(i, j);
  }
});
0

(, "/" ).

, ListGrid createRecordComponent. , , .

ListGrid :

listGrid.setShowRecordComponents(true);
listGrid.setShowRecordComponentsByCell(true);
0

All Articles