Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #1
    Sencha User
    Join Date
    Nov 2011
    Location
    Toronto
    Posts
    105
    Vote Rating
    2
    basememara is on a distinguished road

      0  

    Question Answered: How to get docked button to filter list?

    Answered: How to get docked button to filter list?


    I am trying to use the 'handler' of the button, but I get this error:

    Uncaught TypeError: Object function () { return this.constructor.apply(this, arguments); } has no method 'filter'
    This is the code I am attempting:

    Code:
    {                            xtype: 'button',
                                handler: function(){
                                    MyApp.store.Products.filter('Name', 'Something');
                                }, 
    {
                    xtype: 'list',
                    store: 'Products'
    ...
    }
    Am referencing things right or is there a better way to do this?

  2. Give your list an itemId then use Ext.ComponentQuery.query('itemId')[0].

  3. #2
    Sencha - Sencha Touch Dev Team rdougan's Avatar
    Join Date
    Oct 2008
    Posts
    1,158
    Answers
    93
    Vote Rating
    6
    rdougan will become famous soon enough

      0  

    Default


    MyApp.store.Products in this case is actually a class, not an instance of a store.

    You will need to get a reference to the instance of your store, or a reference to your list.

    One way you could do this is (inside your button handler fn):

    Code:
    var list = this.getParent().down('list');
    
    list.getStore().filter('Name', 'Something');
    It is basically getting the parent of the button (which is also the parent of your list) and then using the down method to find your list. Then using getStore() to get the store of that list, and filtering it.
    Sencha Inc.
    Robert Dougan - @rdougan
    Sencha Touch 2 and Ext JS 4 Core Team Member, SASS/Theming Wizard.

  4. #3
    Sencha User
    Join Date
    Nov 2011
    Location
    Toronto
    Posts
    105
    Vote Rating
    2
    basememara is on a distinguished road

      0  

    Default


    That makes sense, but now I am getting:
    Code:
    Uncaught TypeError: Cannot call method 'getStore' of null
    Is their a cleaner way to get a reference of the container or viewport so I can traverse down to find the list (if that is the issue)? Here is my whole code:
    Code:
    Ext.define('MyApp.view.product.List', {    extend: 'Ext.Panel',
        alias: 'widget.productlist',
    
    
        config: {
            layout: 'fit',
            items: [
                {
                    docked: 'top',
                    items: [
                        {
                            xtype: 'segmentedbutton',
                            allowMultiple: false,
                            defaults: {
                                xtype: 'button'
                            },
                            items: [
                                { text: 'All',
                                handler: function(){
                                    var list = this.getParent().down('list');
                                    list.getStore().filter('Name', 'Something');
                                }},
                                { text: 'Current', pressed: true }
                            ]
                        }
                    ]
                },
                {
                    xtype: 'list',
                    allowDeselect: false,
                    store: 'Products',
                    itemTpl: [
                        '<div>{Name}</div>'
                    ]
                }

  5. #4
    Sencha - Sencha Touch Dev Team rdougan's Avatar
    Join Date
    Oct 2008
    Posts
    1,158
    Answers
    93
    Vote Rating
    6
    rdougan will become famous soon enough

      0  

    Default


    Give your list an itemId then use Ext.ComponentQuery.query('itemId')[0].
    Sencha Inc.
    Robert Dougan - @rdougan
    Sencha Touch 2 and Ext JS 4 Core Team Member, SASS/Theming Wizard.

Thread Participants: 1

Tags for this Thread