Hi,
I want to get the attribute of the smartgwt widget which i am setting like the way in GWT.
For example in GWT:
//Button creation
Button btn1 = new Button(" Button 1");
Button btn2 = new Button("Button 2");
Button btn3 = new Button("Button 3");
//setting the attribute to button doms
btn1.getElement().setAttribute("data-tracking", "Button 1 clicked");
btn2.getElement().setAttribute("data-tracking", "Button 2 clicked");
btn3.getElement().setAttribute("data-tracking", "Button 3 clicked");
//Global handler to catch all the event in my application
Event.addNativePreviewHandler(new NativePreviewHandler() {
public void onPreviewNativeEvent(final NativePreviewEvent event) {
final int eventType = event.getTypeInt();
switch (eventType) {
case Event.ONCLICK:
System.out.println("on clikc clicked"+Element.as(event.getNativeEvent().getEventTarget()).getAttribute("data-tracking"));
//getting the button attribute
if(Element.as(event.getNativeEvent().getEventTarget()).getAttribute("data-tracking")!=null && !Element.as(event.getNativeEvent().getEventTarget()).getAttribute("data-tracking").equals("")){
googleAnalyticsTrackPageView(Element.as(event.getNativeEvent().getEventTarget()).getAttribute("data-tracking"));
}
break;
}
}
});
But in SmartGWT, i was not able to set/get this attribute. Is there a way to solve the problem?
I want to get the attribute of the smartgwt widget which i am setting like the way in GWT.
For example in GWT:
//Button creation
Button btn1 = new Button(" Button 1");
Button btn2 = new Button("Button 2");
Button btn3 = new Button("Button 3");
//setting the attribute to button doms
btn1.getElement().setAttribute("data-tracking", "Button 1 clicked");
btn2.getElement().setAttribute("data-tracking", "Button 2 clicked");
btn3.getElement().setAttribute("data-tracking", "Button 3 clicked");
//Global handler to catch all the event in my application
Event.addNativePreviewHandler(new NativePreviewHandler() {
public void onPreviewNativeEvent(final NativePreviewEvent event) {
final int eventType = event.getTypeInt();
switch (eventType) {
case Event.ONCLICK:
System.out.println("on clikc clicked"+Element.as(event.getNativeEvent().getEventTarget()).getAttribute("data-tracking"));
//getting the button attribute
if(Element.as(event.getNativeEvent().getEventTarget()).getAttribute("data-tracking")!=null && !Element.as(event.getNativeEvent().getEventTarget()).getAttribute("data-tracking").equals("")){
googleAnalyticsTrackPageView(Element.as(event.getNativeEvent().getEventTarget()).getAttribute("data-tracking"));
}
break;
}
}
});
But in SmartGWT, i was not able to set/get this attribute. Is there a way to solve the problem?
Comment