PDA

View Full Version : Help with Linking HTML A tag to TabPanel



seantruman
8 Jul 2009, 8:56 AM
All,

I have a TabPanel with a few TabItems in it. I am using a template to create the content of the TabItems. My problem is that I have a <a/> tag in the template that I need to set the selected TabItem in the TabPanel, any suggestions?

Sean

sven
8 Jul 2009, 8:59 AM
Export a java method, that is selecting the tab, with jsni and call this new javascript method when clicking the a tag.

seantruman
8 Jul 2009, 9:34 AM
public void printString(String t) {


Info.display("PrintString", "PrintString "+t);

}






public native void initScript(IntroTabItem d) /*-{

$wnd.myFunc = function(s) {
d.@com.test.TestTabItem::printString(Ljava/lang/String;)(s);
}
}-*/;






public native void printStringJs(String s) /*-{

$wnd.myFunc(s);


}-*/;


I am adding to my com.test.TestTabItem
this.addText("<a href=\"javascript: printString('Test')\">Test</a>");


I am not having any luck is there a good example some where that explains the JSNI/GXT process in a little more detail?


Sean