1. #1
    Ext User
    Join Date
    Mar 2007
    Posts
    58
    Vote Rating
    0
    luke83 is on a distinguished road

      0  

    Default change a div when onclick event a tab of a content panel

    change a div when onclick event a tab of a content panel


    wow.. what title!!!

    so..

    i have my contentpanel:

    Code:
    layout.add(..);
    ....
    layout.add('center', new YAHOO.ext.ContentPanel('center3', {title: 'Forum', closable: true}));
    now i would like to link a function when u click on the tab named tab, so that i can update a div..
    something like this:

    Code:
    layout.add('center', new YAHOO.ext.ContentPanel('center3', {title: 'Forum', closable: true, onclick: function(){alert(123)}}));
    this don't show 123 when i click on forum label tab, i would like

  2. #2
    Sencha User
    Join Date
    Mar 2007
    Posts
    7,854
    Vote Rating
    4
    tryanDLS is on a distinguished road

      0  

    Default


    Jack may chime in with another solution here, but rather than look for an 'onclick', you could look for the 'activate' event. This is only going to fire on the 1st click, because once a tab is activated, clicking again doesn't really mean anything, unless you click on sub-element of the tab that handles a click, and then bubbles it all the way up to the tab.

    get a ref to your panel, then
    Code:
    //this needs to happen after the panel is added to the region, otherwise it will fire one time //immediately b/c the tab is activated upon add.
    panel.on('activate', myfunc, this, true); 
    
    ...
    function myfunc(panel, obj) {
     alert('123');
    }

  3. #3
    Sencha User jack.slocum's Avatar
    Join Date
    Mar 2007
    Location
    Tampa, FL
    Posts
    6,955
    Vote Rating
    17
    jack.slocum will become famous soon enough jack.slocum will become famous soon enough

      0  

    Default


    That's exactly what I would have suggested.

  4. #4
    Ext User
    Join Date
    Mar 2007
    Posts
    58
    Vote Rating
    0
    luke83 is on a distinguished road

      0  

    Default


    ok..

    it's so simple... but it don't work.. i did this:

    Code:
    layout.add('center', new YAHOO.ext.ContentPanel('center3', {title: 'Forum', closable: true}));
    	                
    layout.getRegion("center").getPanel("center3").on("activate",act3,this,true);
    
    function act3(panel,obj){alert(123)}
    also adding the " to function arg name it don't wont to work.. what i wrong?

    ps: is there a documentation for borderLayout?

  5. #5
    Ext User
    Join Date
    Mar 2007
    Posts
    9
    Vote Rating
    0
    ca8msm is on a distinguished road

      0  

    Default


    This is pretty much the same situation I've just been in. Have a look at the advice Jack offered to me as this worked great:

    http://www.jackslocum.com/forum/viewtopic.php?t=444

  6. #6
    Ext User
    Join Date
    Mar 2007
    Posts
    58
    Vote Rating
    0
    luke83 is on a distinguished road

      0  

    Default


    hi, thx for the reply
    i have read, but nothing changed,it give me error in js console saying that "this.events is not defined"

    i used this code:
    Code:
    Example = function(){
    	        return {
    	            init : function(){   
    [....] // omissions to shorten the code :p
    layout.add('center', new YAHOO.ext.ContentPanel('center3', {title: 'Forum', closable: true}));
    	                
    layout.getRegion("center").getPanel("center3").on("activate",Example.act3,Example,true);
    
    	                layout.getRegion('center').showPanel('content');
    	                layout.endUpdate();
    	           },
    
    act3 : function(){
                       alert('test');
                  }             
    	     }
    	       
    	}();
    	YAHOO.ext.EventManager.onDocumentReady(Example.init, Example, true);

  7. #7
    Sencha User jack.slocum's Avatar
    Join Date
    Mar 2007
    Location
    Tampa, FL
    Posts
    6,955
    Vote Rating
    17
    jack.slocum will become famous soon enough jack.slocum will become famous soon enough

      0  

    Default


    What version are you using? The latest beta? Can you put a link up somewhere? I see nothing obvious in your code so it has to be a weird issue. That event works though, I use it extensively.

  8. #8
    Ext User
    Join Date
    Mar 2007
    Posts
    58
    Vote Rating
    0
    luke83 is on a distinguished road

      0  

    Default


    jack, i know i'm your worse incubus.. :roll:

    so...

    this is the page to obtain:

    http://fantaluke.net/sc/test/correct.htm

    and this is the page with code for the "onActivate" event:

    http://fantaluke.net/sc/test/test.htm

    i'm in your hands...

    as usual.. :lol:

  9. #9
    Sencha User
    Join Date
    Mar 2007
    Posts
    7,854
    Vote Rating
    4
    tryanDLS is on a distinguished road

      0  

    Default


    You might try splitting this line and see if you really have a ref to your panel

    Code:
    layout.getRegion("center").getPanel("center3").on("activate",Example.act3,Example,true);
    
    var p = layout.getRegion("center").getPanel("center3");
    This is the issue I initially had - you're creating a panel with a title='center3', not id='center3'. getPanel is looking for an id, not a title (at least in this beta).

    I didn't try this with your code, but it's basically how I got around it in my code:
    Code:
    var  p = new YAHOO.ext.ContentPanel('center3', {title: '[img]images/tforum.gif[/img] Forum', closable: true});
    
    layout.add('center', p);
    p.on('activate', Example.act3,Example,true);
    Note also that if you add the event to the panel before you add the panel to the layout, the event will fire once immediately. This is b/c activate is fired upon add - this may or may not be what you want.

  10. #10
    Ext User
    Join Date
    Mar 2007
    Posts
    58
    Vote Rating
    0
    luke83 is on a distinguished road

      0  

    Default


    thx a lot for reply but i have no result trying your code.. :? u can see it in test.htm.. :cry: nathing to do..

Similar Threads

  1. "onclick" event for Datefield
    By DrZog in forum Ext 1.x: Help & Discussion
    Replies: 5
    Last Post: 26 Mar 2007, 4:26 PM
  2. How to Dynamically change the content of a BorderLayout.
    By wq7278 in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 7 Mar 2007, 7:35 AM
  3. Updating content panel.
    By joxan in forum Ext 1.x: Help & Discussion
    Replies: 3
    Last Post: 2 Mar 2007, 11:58 PM
  4. tabpanel - how change content
    By rudy in forum Ext 1.x: Help & Discussion
    Replies: 7
    Last Post: 20 Feb 2007, 6:31 AM
  5. Splitbar: Change height according to content
    By Dextro in forum Ext 1.x: Help & Discussion
    Replies: 3
    Last Post: 4 Dec 2006, 6:55 AM

Thread Participants: 3

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi