Thursday, June 12, 2014

Re: is there any way to trigger a method when users mouse over the Title of a column in GWT-CellTable?

I tried



Header<String> nameColumnHeader = new Header<String>(new ClickableTextCell()) {
       
@Override
       
public String getValue() {
           
return "Name";
       
}
       


       
@Override
       
public final void onBrowserEvent(Context context, Element elem, NativeEvent event) {
         
if ("mouseover".equals(event.getType())) {
         
System.out.println("est");
         
SafeHtmlBuilder sb=new SafeHtmlBuilder();
         sb
.appendHtmlConstant("<b>");
 
 sb
.appendHtmlConstant("<font color=\"blue\">");
 sb
.appendEscaped("Subject Name");
 sb
.appendHtmlConstant("</font></b>");
 
         meaningMessagesPopup
.setWidget(new HTML(sb.toSafeHtml()));
       
 
 
int left = event.getClientX() -140;
       
int top = event.getClientY() +30;
        meaningMessagesPopup
.setPopupPosition(left, top);


           
// Show the popup
        meaningMessagesPopup
.show();
         
}
         
else if("mouseout".equals(event.getType())){
         meaningMessagesPopup
.hide();
         
}
       
}
   
};
table.addColumn(nameColumn, nameColumnHeader);
But seem Gwt did not recognize "mouseover".equals(event.getType())


On Friday, June 13, 2014 12:51:03 AM UTC+10, Tom wrote:

Ok, I have a CellTable CellTable<List<String>> table = new CellTable<List<String>>();

& a nameColumn IndexedColumn nameColumn=new IndexedColumn(0)

then table.addColumn(nameColumn, "Name");

I want that when user mouseOver the title of nameColumn it will trigger methodX

The table.addCellPreviewHandler only works for the cell inside the table not for the Title or header of the column

table.addCellPreviewHandler(new Handler<List<String>>(){            @Override          public void onCellPreview(                          CellPreviewEvent<List<String>> event) {            if ("mouseover".equals(event.getNativeEvent().getType())) {                          int col=event.getColumn();                          int row=event.getIndex();          //call sthing here          }  });  

is there any simple method like table.addCellPreviewHandler that help me to solve my problem? I don't like custom Header or custom column?

http://stackoverflow.com/questions/24187482/is-there-any-way-to-trigger-a-method-when-users-mouse-over-the-title-of-a-column

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment