Results 1 to 4 of 4

Thread: StringFilter not working like example

  1. #1
    Sencha User
    Join Date
    Jan 2011
    Posts
    12

    Default StringFilter not working like example

    Hi all of you,
    i'm trying to get a StringFilter working, and it really works, but not as it's expected.
    I've copied the code just as in the example:

    http://dev.sencha.com/deploy/dev/exa...ter-local.html

    And the filter is shown deactivated until reconfigure is called. All ok until here.

    The default behaviour i see in the example is the next:

    -When the textfield is empty, the checkbox Filters is unchecked, and the filter deactivated.
    -When i stat typing in the textfield, the checkbock gets checked, and the filter gets activated.
    -Modifying the textfield, the field is applyied any time i get the value changed.
    -If i delete all the content in the textfield, the checkbox gets unchecked.

    But, in my page, non of this behavious is working. I only get the filter working manually checking the checkbox, and while i'm modifying the value of the textfield, the filter doesn't aply 'on the fly'.

    Anyone has experimented this?
    Thanx in advance,
    Regards

    PD: Neither is possible to select the content of the textfield.

  2. #2
    Sencha User
    Join Date
    Jan 2011
    Posts
    12

    Default Debugging

    Hi again,

    Debugging it, i've seen that a error is fired exactly in the time i edit the content of the textfield (every change i do). The error is this:

    this.inputItem.getValue() is undefined
    .../resources/ext-3.3.1/ux/StringFilter.js Line: 87
    I searched the line in StringFilter.js (my copy is in that root), and it's coming from:

    (........)

    Ext.ux.grid.filter.StringFilter = Ext.extend(Ext.ux.grid.filter.Filter, {
    (........)
    },

    /**
    * @private
    * Template method that is to return <tt>true</tt> if the filter
    * has enough configuration information to be activated.
    * @return {Boolean}
    */
    isActivatable : function () {
    return this.inputItem.getValue().length > 0;
    },

    /**
    (........)

    And since it is a GridFilters extension code, i don't know what is caunsing it.

    I would appreciate any help.

  3. #3
    Sencha User
    Join Date
    Jan 2011
    Posts
    12

    Default Workaround

    I found a workaround, but it's not a "clean" solution, and i can't still made a selection on the textfield, but it works (or it could be said to work). What i've done is:

    First, I've overriden the function isActivatable (the one wich threw the error because this.inputItem.getValue() was undefined):
    Code:
    <script type = "text/javascript">
       
           Ext.override(Ext.ux.grid.filter.StringFilter,{
               isActivatable : function () {
            return true; //this.inputItem.startValue.length > 0;
            }
        });
        
       </script>
    and inside the createColModel function, i have initialized the filter as active:

    Code:
    filter:{type: 'string',active:true}
    If anyoune could have a better solution, I'd really appreciate that.

    Regards

  4. #4
    Sencha User
    Join Date
    Sep 2010
    Posts
    2

    Default

    Hi there,
    Thanks a lot for the workaround. I had the same bug.
    After i fixed that, i found this other bug:
    this.getValue() is undefined

    I fixed it with this other workaround:
    Code:
    Ext.override(Ext.ux.grid.filter.StringFilter,{
                    isActivatable:    function() {
                                        return true; //this.inputItem.startValue.length > 0;
                                    },
                    validateRecord:    function (record) {
                                        var val = record.get(this.dataIndex);
                                        if (typeof val != 'string') {
                                            return (this.getValue().length === 0);
                                        }
                                        if (typeof this.getValue() != 'undefined') {
                                            return val.toLowerCase().indexOf(this.getValue().toLowerCase()) > -1;
                                        } else {
                                            return true;
                                        }
                                    }
                });

Similar Threads

  1. GXT 2.2.0 and Grid's StringFilter layout problem with IE
    By pepez in forum Ext GWT: Discussion
    Replies: 1
    Last Post: 27 Sep 2010, 1:29 AM
  2. GridFilter - StringFilter onchange
    By wiulma in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 8 Feb 2010, 7:18 AM
  3. Replies: 4
    Last Post: 30 Sep 2009, 6:32 PM
  4. Ext.grid.filter.StringFilter.prototype.icon double image?
    By jfizer in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 28 Jul 2009, 10:54 PM

Posting Permissions

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