I need to hide a page of the tab when I click a button

Develop and Deploy Cross-Browser Web Apps .

I need to hide a page of the tab when I click a button

Postby macscripter » Tue Feb 04, 2014 1:36 pm

Hi!
I would like to hide/show a page in the tab when a click a button. Cold someone help me?
Thanks! Here goes a code:

Code: Select all
// The default code is a com class (inherited from xui.Com)
Class('App', 'xui.Com',{
    // Ensure that all the value of "key/value pair" does not refer to external variables
    Instance:{
        // To initialize instance(e.g. properties)
        initialize : function(){
            // To determine whether or not the com will be destroyed, when the first UI control be destroyed
            this.autoDestroy = true;
            // To initialize properties
            this.properties = {};
        },
        // To initialize internal components (mostly UI controls)
        // *** If you're not a skilled, dont modify this function manually ***
        iniComponents : function(){
            // [[Code created by CrossUI RAD Tools
            var host=this, children=[], append=function(child){children.push(child.get(0));};
           
            append((new xui.UI.Tabs())
            .setHost(host,"ctl_tabs2")
            .setItems([{"id":"a", "caption":"page1", "image":"img/demo.gif"}, {"id":"b", "caption":"page2", "image":"img/demo.gif"}, {"id":"c", "caption":"page3", "image":"img/demo.gif"}, {"id":"d", "caption":"page4", "image":"img/demo.gif", "closeBtn":true, "optBtn":true, "popBtn":true}])
            .setDock("none")
            .setLeft(0)
            .setTop(0)
            .setWidth(500)
            .setHeight(160)
            .setValue("b")
            );
           
            append((new xui.UI.SButton())
            .setHost(host,"ctl_sbutton5")
            .setLeft(40)
            .setTop(180)
            .setCaption("ctl_sbutton5")
            .onClick("_ctl_sbutton5_onclick")
            );
           
            return children;
            // ]]Code created by CrossUI RAD Tools
        },
        // Give a chance to load other com
        iniExComs : function(com, threadid){
        },
        // Give a chance to determine which UI controls will be appended to parent container
        customAppend : function(parent, subId, left, top){
            // "return false" will cause all the internal UI controls will be added to the parent panel
            return false;
        },
        // This instance's events
        events : {},
        _ctl_sbutton1_onclick : function (profile, e, src, value) {
            var uictrl = profile.boxing();
            xui.alert("hi","I'm " + uictrl.getAlias());
        },
        _ctl_sbutton5_onclick:function (profile,e,src,value){
            var ns = this, uictrl = profile.boxing();
           
            // here I need to hide, for example page2 of the ctl_tabs2
        }
    }
});

macscripter
 
Posts: 21
Joined: Wed Apr 24, 2013 12:53 pm

Re: I need to hide a page of the tab when I click a button

Postby support » Thu Feb 06, 2014 8:21 am

   
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.Tabs())
.setHost(host,"ctl_tabs2")
.setItems([{"id":"a", "caption":"page1", "image":"img/demo.gif"}, {"id":"b", "caption":"page2", "image":"img/demo.gif"}, {"id":"c", "caption":"page3", "image":"img/demo.gif"}, {"id":"d", "caption":"page4", "image":"img/demo.gif", "closeBtn":true, "optBtn":true, "popBtn":true}])
.setDock("none")
.setLeft(0)
.setTop(0)
.setWidth(500)
.setHeight(160)
.setValue("b")
);

append((new xui.UI.SButton())
.setHost(host,"ctl_sbutton5")
.setLeft(40)
.setTop(180)
.setCaption("ctl_sbutton5")
.onClick("_ctl_sbutton5_onclick")
);

return children;
// ]]Code created by CrossUI RAD Tools
},
_ctl_sbutton5_onclick:function (profile,e,src,value){
var ns = this, uictrl = profile.boxing();

ns.ctl_tabs2.updateItem("b",{hidden:true});
}
}
});
   
support
 
Posts: 352
Joined: Sat Apr 27, 2013 9:22 am

Re: I need to hide a page of the tab when I click a button

Postby macscripter » Thu Feb 06, 2014 2:17 pm

Waw!!!! So easy!!!!
Thank you!!!! it works perfectly!

Regards!
macscripter
 
Posts: 21
Joined: Wed Apr 24, 2013 12:53 pm


Return to CrossUI for Web Apps

Who is online

Users browsing this forum: No registered users and 0 guests

cron