Do the following steps to implement the event mechanism:
this.handler1=function(){ alert("handler!!!"); BTTUtil.Servicelist.addListener('1.2', 'onclick', function(){ if(!BTTUtil.Servicelist.isCategoryNode('2.4')) { var tabId = BTTUtil.Workarea.addTab(); var columnId= BTTUtil.Workarea.addColumn(tabId); var rowId= BTTUtil.Workarea.addService(columnId,0, {title : 'testADDROW007', draggable : '1'}, {id : "simpleHTMLWgt", attribute : {url:"http://www.ibm.com"}} ); BTTUtil.Workarea.showTab(tabId); } }); BTTUtil.Servicelist.addListener('1.3', 'beforeonclick', function(){ if(!BTTUtil.Servicelist.isCategoryNode('2.4')) { alert("beforeonclick"); } }); }
<iw:itemSet id="attributes" private="true"> <iw:item id="url" value="http://www.ibm.com"/> <iw:item id="height" value="300"/> </iw:itemSet> <iw:event id="event1" onEvent="handler1"/> <iw:content mode="view">
BTTMain.Portal.widgetRunTime.eventRepository.fireEvent('event1');
API | Input | Output |
---|---|---|
BTTMain.Portal.widgetRunTime.eventRepository.fireEvent | P1,P2, P3,…Pn | P1 is the event id, P2,…Pn are the input parameter of handler . |
BTTMain.Portal.widgetRunTime.eventRepository.fireEvent('event1','2.4','this is event for 2.4') |
this.handler1=function(serviceid, message){ BTTUtil.Servicelist.addListener(serviceid, 'onclick', function(){ if(!BTTUtil.Servicelist.isCategoryNode(serviceid)) { alert(message); var tabId = BTTUtil.Workarea.addTab(); var columnId= BTTUtil.Workarea.addColumn(tabId); var rowId= BTTUtil.Workarea.addService(columnId,0, {title : message, draggable : '1'}, {id : "simpleHTMLWgt", attribute : {url:"http://www.goolge.com"}} ); BTTUtil.Workarea.showTab(tabId); } }); |
The input for serviceid is 2.4 and the input for message is this is event for 2.4 as shown in Table 2.