1. #1
    Ext User
    Join Date
    Sep 2007
    Posts
    104
    Vote Rating
    0
    robin30 is on a distinguished road

      0  

    Default (SOLVED) scroll dataview automatically to the buttom

    (SOLVED) scroll dataview automatically to the buttom


    hi all,

    have a little question.

    I have a tabpanel with a dataview in it.
    PHP Code:
    var chatstore = new Ext.data.JsonStore({

            
    url'database.php',

            
    baseParams:{task"GETCHATS",
                            
    lines'9'
                            
    },

            
    root'images',

            
    fields: ['chats']

        });

        
    chatstore.load();
        
        var 
    tpl = new Ext.XTemplate(

            
    '<tpl for=".">',

                    
    '<div id="yummie">{chats}</div>',

            
    '</tpl>',

            
    '<div class="x-clear"></div>'

        
    )
        
    var 
    view = new Ext.DataView({

            
    height:380,
            
    id:'viewchat',
            
    name:'viewchat',

            
    emptyText'<div class="info">Error !!!!!!</div>',

            
    itemSelector:'div.yummie',
            
    storechatstore,

            
    tpltpl,
        });

     var 
    tabs = new Ext.TabPanel({
            
    id:'tabs',
                
    region    'center'
                
    activeTab 0
                
    border:true,
                
    height380,
                
    autoScroll:true,
                
    bodyStyle:'padding:5px;padding-top:3px;padding-bottom:20px;',
                
    items     : [view]
            }); 
    how can i let the dataview scroll automatically to the buttom?

    i'm using animal's code:
    PHP Code:
    Ext.override(Ext.Element, {
        
    scrollTo : function(sidevalueanimate){
            var 
    side side.toLowerCase();
            var 
    prop;
            switch (
    side) {
                case 
    "left":
                    
    prop "scrollLeft";
                    break;
                case 
    "right":
                    
    prop "scrollLeft";
                    
    value this.dom.scrollWidth - (value this.dom.clientWidth);
                    break;
                case 
    "top":
                    
    prop "scrollTop";
                    break;
                case 
    "bottom":
                    
    prop "scrollTop";
                    
    value this.dom.scrollHeight - (value this.dom.clientHeight);
                    break;
            }
            if (
    value 0value 0;
            if(!
    animate || !Ext.lib.Anim){
                
    this.dom[prop] = value;
            }else{
                var 
    to prop == "scrollLeft" ? [valuethis.dom.scrollTop] : [this.dom.scrollLeftvalue];
                
    this.anim({scroll: {"to"to}}, this.preanim(arguments2), 'scroll');
            }
            return 
    this;
        }
    }); 
    but when i do this:
    PHP Code:
    view.scrollTo("bottom"0,true); 
    or this
    PHP Code:
    view.scroll("bottom",0
    it doesn't work.

    any help is appreciated,

    Regards,
    robin30

  2. #2
    Ext User
    Join Date
    Sep 2007
    Posts
    104
    Vote Rating
    0
    robin30 is on a distinguished road

      0  

    Wink found the answer

    found the answer


    found the answer to my problem.

    i removed animal's code
    then i used:

    PHP Code:
    chatstore.on('load',function(){
    Ext.getCmp('tabs').body.scroll('bottom',5000,false);
    }) 
    and it works. YAAAAAAAAHOOOOOOOOW

    hope that's it helpfull for somebody else too

    Regards,

    robin30