1. #1
    Sencha User
    Join Date
    Oct 2011
    Location
    The Hague, The Netherlands.
    Posts
    11
    Vote Rating
    0
    Edition1 is on a distinguished road

      0  

    Default Unanswered: Scroll Events in TouchGridPanel

    Unanswered: Scroll Events in TouchGridPanel


    Hi ,

    I wanted to capture "Scroll" event of the TouchGridPanel.

    Any ideas, pointers for the same?

    My requirement is to make 1st column of grid freeze. So am trying to put 1 list and touchGridPanel in a Panel.
    Now I have captured scroll event of the list and accordingly setting offset for the Grid as well.

    rptList.scroller.on('scroll', scrollGrid);

    But vice-versa for the grid is not working.. i.e when am scrolling grid, the function is not getting called.
    grid.scroller.on('scroll', scrollList);

    Please advice.

    Thanks in advance.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,547
    Vote Rating
    873
    Answers
    3566
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    All the TouchGridPanel is is a Panel with a DataView. So get the scroller on the dataview and listen to it's events.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Feb 2012
    Posts
    26
    Vote Rating
    0
    Syntona is on a distinguished road

      0  

    Default


    Hi,
    I am trying to capture Scroll event on TouchGridPanel .

    As per suggestion, I did the following code but on scroll
    it is not at all coming to
    startScroll function.
    neither it is giving any error.

    Could you please point out the mistake or any pointer. Thanks in advance.


    Code:
    Ext.ux.TouchGridPanel = Ext.extend(Ext.Panel, {
        layout        : "fit",
         multiSelect   : false,
        scroll        : "both",
    
        initComponent : function() {
            var me = this;
            me.items = me.dataview = me.buildDataView();
    
            if (!Ext.isArray(me.dockedItems)) {
                me.dockedItems = [];
            }
             me.header = new Ext.Component(me.buildHeader());
            me.dockedItems.push(me.header);
    
            Ext.ux.TouchGridPanel.superclass.initComponent.call(me);
    
            var store = me.store;
             store.on("update", me.dispatchDataChanged, me);
    
             var dataview = me.dataview;        
            dataview.on("scroll", me.startScroll, me);
    
        },
    
    startScroll: function (scroller, offset) {
            console.log('is this event captured???')
            var me = this;
    
    
            me.fireEvent("scroll", this.scroller, offset);
        },

  4. #4
    Sencha User
    Join Date
    Feb 2012
    Posts
    26
    Vote Rating
    0
    Syntona is on a distinguished road

      0  

    Default


    Hi

    Update to previous post.

    I guess, can listen to scroll event only after data loaded.
    before that var scroller = me.dataview.scroller; is always NULL.

    I tried to get the scroller after the grid data loaded.

    i.e @ where am displaying grid
    Code:
     
     var grid1 = new Ext.ux.TouchGridPanel({
    ....
    
     gridStore.on('load', function() {    
       grid1.scroller.on('scroll', function(){               console.log('is this event captured???');
                });
    }
    But still am not able to capture scroll event when i scroll Grid.

  5. #5
    Sencha User
    Join Date
    Feb 2012
    Posts
    26
    Vote Rating
    0
    Syntona is on a distinguished road

      0  

    Default


    Hi,

    just to update, i managed to scroll the grids.

Thread Participants: 2

Tags for this Thread