Ext


Go Back   Ext JS Forums > Ext JS Community Forums (2.0) > Ext 2.x: Help

Reply
 
Thread Tools
  #1  
Old 04-11-2008, 04:51 AM
brenda brenda is offline
Ext User
 
Join Date: Mar 2008
Posts: 56
brenda is on a distinguished road
Default Card Layout: Browsing different cards

Hi guys,
I have been browsing and searching the forum since the first day I lay my hands on ExtJS and solved several problems

Recently, I tried to call different panel to be displayed with the click of some buttons. The best and nearest solution that I can get is http://extjs.com/forum/showthread.php?t=29689 and http://extjs.com/forum/showthread.php?t=26986 (Thanks a lot guys )

I've tried to modify that and now I am able to browse the different cards in a non-sequential way. I was thinking of sharing it as a way to say thank you to everyone who has helped me along in some way.

PS: There may be a better solution then this, please share if you know of any.


var navHandler = function(cardNo){

       var 
lay event.getLayout();
       if (
cardNo == 0){
           
lay.setActiveItem(0);
           
Ext.getCmp('btn1').disable();
           
Ext.getCmp('btn2').enable();
           
Ext.getCmp('btn3').enable();
       } else if (
cardNo == 1){
           
lay.setActiveItem(1);
           
Ext.getCmp('btn2').disable();           
           
Ext.getCmp('btn1').enable();
           
Ext.getCmp('btn3').enable();
       } else if (
cardNo == 2){
           
lay.setActiveItem(2);
           
Ext.getCmp('btn3').disable();
           
Ext.getCmp('btn1').enable();
           
Ext.getCmp('btn2').enable();
       }
    };
           
     var 
event = new Ext.Panel({
         
title'Example Wizard',
        
layout:'card',
        
activeItem0// make sure the active item is set on the container config!
        
bodyStyle'padding:15px',
        
defaults: {
            
// applied to each contained panel
            
border:false
        
},
        
// just an example of one possible navigation scheme, using buttons
        
tbar: [
            {
                
text'Add new'
            
},'-'// greedy spacer so that the buttons are aligned to each side
            
{
                
id'btn1',
                
text'Button 1',
                
handlernavHandler.createDelegate(this, [0]),
                
disabledtrue
            
},{
                
id'Button 2',
                
text'Week',
                
handlernavHandler.createDelegate(this, [1])
            },{
                
id'btn3',
                
text'Button 3',
                
handlernavHandler.createDelegate(this, [2])
            }
        ],
        
// the panels (or "cards") within the layout
        
items: [{
            
id'card-0',
            
html'<h1>Welcome to the Wizard!</h1><p>Step 1 of 3</p>'
        
},{
            
id'card-1',
            
html'<p>Step 2 of 3</p>'
        
},{
            
id'card-2',
            
html'<h1>Congratulations!</h1><p>Step 3 of 3 - Complete</p>'
        
}] 
Reply With Quote
  #2  
Old 04-11-2008, 05:00 AM
Animal's Avatar
Animal Animal is offline
Ext JS - Community Support Team
 
Join Date: Mar 2007
Location: East Midlands, UK
Posts: 23,352
Animal will become famous soon enough
Default

I have a CardPanel class which allowd adding of child items, and automatically creates a toggle Button in its bottom Toolbar for each item added, so you get a button for each one.

I wrote it for a client though, so I'll need his permission to post the code publicly. I'll ask him tonight. (You might have to bump this thread this evening GMT timeone to remind me)
__________________
ExtJs forum volunteer. No official connection to the Ext Company. I do not speak for them.
ExtJs consultancy offered. £ 50/hour. Evenings+weekends. the_bagbournes@btinternet.com

Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
See Saki's samples: http://examples.extjs.eu/
Build your own Ext: http://extjs.com/products/extjs/build/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
Reply With Quote
  #3  
Old 04-11-2008, 05:07 AM
brenda brenda is offline
Ext User
 
Join Date: Mar 2008
Posts: 56
brenda is on a distinguished road
Default

Quote:
Originally Posted by Animal View Post
I have a CardPanel class which allowd adding of child items, and automatically creates a toggle Button in its bottom Toolbar for each item added, so you get a button for each one.

I wrote it for a client though, so I'll need his permission to post the code publicly. I'll ask him tonight. (You might have to bump this thread this evening GMT timeone to remind me)
That will be nice
I'll bump this up later this evening.. Thank, Animal
Reply With Quote
  #4  
Old 04-12-2008, 12:05 AM
brenda brenda is offline
Ext User
 
Join Date: Mar 2008
Posts: 56
brenda is on a distinguished road
Default

bumpz.. Sorry Animal, I was tired and retired early yesterday
Reply With Quote
  #5  
Old 04-12-2008, 03:17 AM
Animal's Avatar
Animal Animal is offline
Ext JS - Community Support Team
 
Join Date: Mar 2007
Location: East Midlands, UK
Posts: 23,352
Animal will become famous soon enough
Default

OK, I'll email that client, and see if he will let me share the code...
__________________
ExtJs forum volunteer. No official connection to the Ext Company. I do not speak for them.
ExtJs consultancy offered. £ 50/hour. Evenings+weekends. the_bagbournes@btinternet.com

Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
See Saki's samples: http://examples.extjs.eu/
Build your own Ext: http://extjs.com/products/extjs/build/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
Reply With Quote
  #6  
Old 04-12-2008, 04:42 AM
Animal's Avatar
Animal Animal is offline
Ext JS - Community Support Team
 
Join Date: Mar 2007
Location: East Midlands, UK
Posts: 23,352
Animal will become famous soon enough
Default

Someone else has been doing something very similar on another thread. I've responsed there: http://extjs.com/forum/showthread.ph...880#post151880
__________________
ExtJs forum volunteer. No official connection to the Ext Company. I do not speak for them.
ExtJs consultancy offered. £ 50/hour. Evenings+weekends. the_bagbournes@btinternet.com

Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
See Saki's samples: http://examples.extjs.eu/
Build your own Ext: http://extjs.com/products/extjs/build/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
Reply With Quote
  #7  
Old 04-13-2008, 09:39 PM
brenda brenda is offline
Ext User
 
Join Date: Mar 2008
Posts: 56
brenda is on a distinguished road
Default

Quote:
Originally Posted by Animal View Post
Someone else has been doing something very similar on another thread. I've responsed there: http://extjs.com/forum/showthread.ph...880#post151880
Thank Animal, I'll take look at that
Reply With Quote
  #8  
Old 04-14-2008, 03:49 PM
surfyogi surfyogi is offline
Ext JS Premium Member
 
Join Date: Mar 2008
Posts: 62
surfyogi is on a distinguished road
Default

Brenda,
Animal was trying to help me with his example at the link just above, but I could not get it to work.

I'm not very familiar with CardLayout or CardPanel yet. Do you want to give it a try?
thx, Jeff-
Reply With Quote
Reply

Thread Tools

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

All times are GMT -5. The time now is 08:53 AM.

© 2006-2009 Ext, LLC
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.