How to trigger event manually?

Find code here before you post.
Locked
linb
Site Admin
Posts: 102
Joined: Thu Apr 25, 2013 6:51 am

How to trigger event manually?

Post by linb »

   
Class('App', 'xui.Com',{
    Instance:{
        iniComponents : function(){
            // [[Code created by CrossUI RAD Tools
            var host=this, children=[], append=function(child){children.push(child.get(0))};
            
            append(
                (new xui.UI.SButton)
                .setHost(host,"ctl_sbutton1")
                .setLeft(220)
                .setTop(240)
                .setCaption("Trigger beforePageClose Event only")
                .onClick("_ctl_sbutton1_onclick")
            );
            
            append(
                (new xui.UI.Pane)
                .setHost(host,"ctl_pane6")
                .setLeft(220)
                .setTop(30)
                .setWidth(370)
                .setHeight(190)
            );
            
            host.ctl_pane6.append(
                (new xui.UI.Tabs)
                .setHost(host,"ctl_tabs2")
                .setItems([{"id":"a", "caption":"item a", "image":"img/demo.gif"}, {"id":"b", "caption":"item b", "image":"img/demo.gif"}, {"id":"c", "caption":"item c", "image":"img/demo.gif"}, {"id":"d", "caption":"item d", "image":"img/demo.gif"}])
                .setValue("a")
                .beforePageClose("_ctl_tabs2_beforepageclose")
            );
            
            append(
                (new xui.UI.SButton)
                .setHost(host,"ctl_sbutton8")
                .setLeft(470)
                .setTop(240)
                .setCaption("Trigger Dom Event")
                .onClick("_ctl_sbutton8_onclick")
            );
            
            return children;
            // ]]Code created by CrossUI RAD Tools
        },
        _ctl_sbutton1_onclick : function (profile, e, src, value) {
            var tab=this.ctl_tabs2;
            // Trigger
            tab.beforePageClose(tab.get(0), tab.getItemByItemId('b'));
            // Or
            // tab.beforePageClose(tab.getItemByItemId('b'));
        },
        _ctl_tabs2_beforepageclose : function (profile, item, src) {
            xui.pop(item.id);
        },
        _ctl_sbutton8_onclick : function (profile,e,src,value){
            var tab=this.ctl_tabs2;
            // Trigger
            tab.getSubNode("ITEM","c").onMousedown(true);
        }
    }
});
Class('App', 'xui.Com',{
    Instance:{
        iniComponents : function(){
            // [[Code created by CrossUI RAD Tools
            var host=this, children=[], append=function(child){children.push(child.get(0))};
            
            append(
                (new xui.UI.SButton)
                .setHost(host,"ctl_sbutton1")
                .setLeft(220)
                .setTop(240)
                .setCaption("Trigger beforePageClose Event only")
                .onClick("_ctl_sbutton1_onclick")
            );
            
            append(
                (new xui.UI.Pane)
                .setHost(host,"ctl_pane6")
                .setLeft(220)
                .setTop(30)
                .setWidth(370)
                .setHeight(190)
            );
            
            host.ctl_pane6.append(
                (new xui.UI.Tabs)
                .setHost(host,"ctl_tabs2")
                .setItems([{"id":"a", "caption":"item a", "image":"img/demo.gif"}, {"id":"b", "caption":"item b", "image":"img/demo.gif"}, {"id":"c", "caption":"item c", "image":"img/demo.gif"}, {"id":"d", "caption":"item d", "image":"img/demo.gif"}])
                .setValue("a")
                .beforePageClose("_ctl_tabs2_beforepageclose")
            );
            
            append(
                (new xui.UI.SButton)
                .setHost(host,"ctl_sbutton8")
                .setLeft(470)
                .setTop(240)
                .setCaption("Trigger Dom Event")
                .onClick("_ctl_sbutton8_onclick")
            );
            
            return children;
            // ]]Code created by CrossUI RAD Tools
        },
        _ctl_sbutton1_onclick : function (profile, e, src, value) {
            var tab=this.ctl_tabs2;
            // Trigger
            tab.beforePageClose(tab.get(0), tab.getItemByItemId('b'));
            // Or
            // tab.beforePageClose(tab.getItemByItemId('b'));
        },
        _ctl_tabs2_beforepageclose : function (profile, item, src) {
            xui.pop(item.id);
        },
        _ctl_sbutton8_onclick : function (profile,e,src,value){
            var tab=this.ctl_tabs2;
            // Trigger
            tab.getSubNode("ITEM","c").onMousedown(true);
        }
    }
});
   

Locked