[CLOSED] StringFilter and DateFilter activate/deactivate

  1. #1

    [CLOSED] StringFilter and DateFilter activate/deactivate

    Hi,

    I have a requirement to provide a two-way feedback between the GridPanel filter activation checkbox and the filter items. Some time ago, I got a working solution on this forum for the ListFilter to achieve that:

                                <ext:ListFilter DataIndex="Field1" StoreID="StoreOptions1"
                                    LabelField="Field1">
                                    <Listeners>
                                        <Deactivate Handler="this.menu.items.each(function (item) {
                                                                item.setChecked(false);
                                                             });" />
                                    </Listeners>
                                </ext:ListFilter>
    I'm trying to accomplish the same feat for StringFilter and DateFilter. However, when I put the code below into the StringFilter Deactivate Listener definition, it doesn't activate when one types into the filter item textbox. I have to manually check off the activation checkbox for it to become active. It's back to normal without the listener.

                                
    <ext:StringFilter DataIndex="Field1">
                                    <Listeners>
                                        <Deactivate Handler="this.menu.items.each(function (item) {
                                                                item.setValue('');
                                                             });" />
                                    </Listeners>
    </ext:StringFilter>
    Please suggest a workaround.
    Last edited by Daniil; Jul 06, 2012 at 4:02 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Thanks for the report.

    Please update to the revision #4182 or use this fix locally:

    Fix
    <ext:ResourcePlaceHolder runat="server" Mode="ScriptFiles" />
    
    <script type="text/javascript">
        Ext.ux.grid.filter.StringFilter.override({
            init : function (config) {
                Ext.ux.grid.filter.StringFilter.superclass.init.call(this, config);
    
                delete config.listeners;
            
                Ext.applyIf(config, {
                    enableKeyEvents: true,
                    iconCls: this.iconCls,
                    listeners: {
                        scope: this,
                        keyup: this.onInputKeyUp
                    }
                });
    
                this.inputItem = new Ext.form.TextField(config); 
                this.menu.add(this.inputItem);
                this.updateTask = new Ext.util.DelayedTask(this.fireUpdate, this);
            }
        });
    </script>
  3. #3
    Thanks Daniil!

    I updated the source code from http://svn.ext.net/premium/trunk and the issue has disappeared. The listener below now works properly. Was the trunk updated with that revision already?

    <ext:StringFilter DataIndex="Field1">
              <Listeners>
                      <Deactivate Handler="this.menu.items.each(function (item) {
                                                                item.setValue('');
                                                       });" />
              </Listeners>
    </ext:StringFilter>
    Edit in:
    Also, can you please provide the solution for clearing the DateFilter options when it's deactivated? The code below doesn't work for me:

                                
    <ext:DateFilter DataIndex="SomeDate">
              <DatePickerOptions runat="server" TodayText="Now" />
              <Listeners>
                        <Deactivate Handler="this.menu.items.each(function (item) {
                                                                item.setChecked(false);
                                                         });" />
             </Listeners>
    </ext:DateFilter>
  4. #4
    Quote Originally Posted by vadym.f View Post
    I updated the source code from http://svn.ext.net/premium/trunk and the issue has disappeared. The listener below now works properly. Was the trunk updated with that revision already?
    Well, all Ext.NET v1 revisions have committed to the trunk.

    Quote Originally Posted by vadym.f View Post
    <ext:StringFilter DataIndex="Field1">
              <Listeners>
                      <Deactivate Handler="this.menu.items.each(function (item) {
                                                                item.setValue('');
                                                       });" />
              </Listeners>
    </ext:StringFilter>
    You could use just
    <Deactivate Handler="this.inputItem.clear();" />
    Quote Originally Posted by vadym.f View Post
    Also, can you please provide the solution for clearing the DateFilter options when it's deactivated? The code below doesn't work for me:

                                
     <ext:DateFilter DataIndex="SomeDate">
               <DatePickerOptions runat="server" TodayText="Now" />
               <Listeners>
                         <Deactivate Handler="this.menu.items.each(function (item) {
                                                                 item.setChecked(false);
                                                          });" />
              </Listeners>
     </ext:DateFilter>
    I would look into the DataFilter JavaScript sources:
    <Ext.Net sources root>\Ext.Net\Build\Ext.Net\ux\plugins\gridfilters \gridfilters.js

    There should be the answer.
  5. #5
    Thanks Daniil!

    <Deactivate Handler="this.inputItem.clear();" />
    throws a client side error for a DateFilter control. Here's what's worked for me:

                                <ext:DateFilter DataIndex="SomeDate">
                                    <DatePickerOptions runat="server" TodayText="Now" />
                                    <Listeners>
                                        <Deactivate Handler="this.menu.items.each(function (item) {
                                                                if(item.setChecked)
                                                                    item.setChecked(false);
                                                             });" />
                                    </Listeners>
                                </ext:DateFilter>
    There're 5 items in a DateFilter's menu, one of which seems to be of the DatePicker type therefore not having the setChecked() method defined. That's why I need a check for it. If you know of a better way to handle this requirement, please suggest. Otherwise, you can mark this thread as resolved.
  6. #6
    Quote Originally Posted by vadym.f View Post
    <Deactivate Handler="this.inputItem.clear();" />
    throws a client side error for a DateFilter control.
    Yes, the suggestion was for the StringFilter only.

    Quote Originally Posted by vadym.f View Post
    Here's what's worked for me:

                                <ext:DateFilter DataIndex="SomeDate">
                                    <DatePickerOptions runat="server" TodayText="Now" />
                                    <Listeners>
                                        <Deactivate Handler="this.menu.items.each(function (item) {
                                                                if(item.setChecked)
                                                                    item.setChecked(false);
                                                             });" />
                                    </Listeners>
                                </ext:DateFilter>
    There're 5 items in a DateFilter's menu, one of which seems to be of the DatePicker type therefore not having the setChecked() method defined. That's why I need a check for it. If you know of a better way to handle this requirement, please suggest. Otherwise, you can mark this thread as resolved.
    Well, the third item is a menu separator:
    menuItems : ['before', 'after', '-', 'on']
    I think your solution is good.
  7. #7
    Quote Originally Posted by Daniil View Post
    Yes, the suggestion was for the StringFilter only.



    Well, the third item is a menu separator:
    menuItems : ['before', 'after', '-', 'on']
    I think your solution is good.
    Thanks for the clarification! That has answered my question.

Similar Threads

  1. [CLOSED] Deactivate tab at runtime
    By rnachman in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Nov 24, 2011, 4:07 PM
  2. [CLOSED] ext:StringFilter & Renderer on grid
    By peter.campbell in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: May 27, 2011, 10:37 AM
  3. [CLOSED] ComponentMenuItem: the best way to hide/deactivate?
    By capecod in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Nov 05, 2010, 10:43 AM
  4. [CLOSED] StringFilter in custom column
    By 78fede78 in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Nov 04, 2010, 9:39 AM
  5. [CLOSED] Deactivate Rows in a CheckBoxSelectionModel
    By macap in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Apr 19, 2010, 9:26 AM

Tags for this Thread

Posting Permissions