Results 1 to 3 of 3

Thread: How to enable filters on page load

  1. #1
    Sencha User
    Join Date
    Jul 2017
    Posts
    5
    Answers
    1
    Vote Rating
    0
      0  

    Default How to enable filters on page load

    I want to filter my grid with different buttons that active certain filters. However they do not work on page load. Only when you select/deselect a filter option and then click the button, does the filter actually kick in.

    The error I get when the first page loads is:

    Code:
    app.js:330 Uncaught TypeError: Cannot read property 'setActive' of undefined
    How do I enable these filter settings when the page first loads?

    Buttons
    Code:
     var openButton = Ext.create('Ext.Button', {
                text: 'Open Topics',
                handler: function () {
                    var filter = grid[uniqueId].filters.getFilter('TopicStateValue');
                    filter.setActive(true);
                    filter.setValue('Open/Current');
                }
            });
            var holdButton = Ext.create('Ext.Button', {
                text: 'On Hold Topics',
                handler: function () {
                    var filter = grid[uniqueId].filters.getFilter('TopicStateValue');
                    filter.setActive(true);
                    filter.setValue('Hold');
                }
            });
            var closedButton = Ext.create('Ext.Button', {
                text: 'Closed Topics',
                handler: function () {
                    var filter = grid[uniqueId].filters.getFilter('TopicStateValue');
                    filter.setActive(true);
                    filter.setValue('Archived/Closed');
                }
            });
    Columns

    Code:
    columns: [{
                text: 'Title',
                width: 260,
                dataIndex: 'Title',
                filterable: true,
                filter: {
                    type: 'string'
                        // specify disabled to disable the filter menu
                        //, disabled: true
                }
            }, {
                text: 'Description',
                flex: 1,
                dataIndex: 'Description',
                filter: {
                    type: 'string'
                        // specify disabled to disable the filter menu
                        //, disabled: true
                }
            }, {
                text: 'Modified',
                width: 90,
                dataIndex: 'Modified',
                xtype: 'datecolumn',
                format: 'm/d/Y',
                filter: true
            }, {
                text: 'Status',
                width: 100,
                dataIndex: 'TopicStateValue',
                filter: {
                    active: true,
                    type: 'list',
                    value: 'Open/Current',
                    options: ['Open/Current', 'Archived/Closed', 'Hold']
                }
            }]
    fiddle





  2. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985
    Answers
    506
    Vote Rating
    296
      0  

    Default

    I'm not seeing the error. What do I need to do to trigger it?

  3. #3
    Sencha User
    Join Date
    Jul 2017
    Posts
    5
    Answers
    1
    Vote Rating
    0
      0  

    Default

    Quote Originally Posted by Gary Schlosberg View Post
    I'm not seeing the error. What do I need to do to trigger it?
    The error is the buttons don't work when the page is loaded. When you click 'On Hold Topics' the grid should filter to only items with 'Hold' status. That doesn't happen in the fiddle on page load. If you open up the console when the page loads and click one of the buttons, there's an error.

Similar Threads

  1. Enable Pinch Zoom for entire page
    By paulorossi in forum Sencha Touch 2.x: Q&A
    Replies: 1
    Last Post: 15 Aug 2013, 7:27 AM
  2. Replies: 2
    Last Post: 13 Mar 2013, 7:37 AM
  3. Replies: 1
    Last Post: 27 Mar 2012, 6:09 AM
  4. Problem submitting EXTJS form with CAS filters enable
    By mzubair85 in forum Ext 3.x: Help & Discussion
    Replies: 4
    Last Post: 19 Dec 2011, 6:25 AM
  5. ListStore insertions get removed if filters are enable
    By larvelljones in forum Ext GWT: Bugs (1.x)
    Replies: 0
    Last Post: 27 May 2008, 6:18 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •