1. #151
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    91
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    In that case you should be using:
    Code:
    <link rel="stylesheet" type="text/css" href="ext/examples/ux/gridfilters/css/GridFilters.css" />
    <link rel="stylesheet" type="text/css" href="ext/examples/ux/gridfilters/css/RangeMenu.css" />
    <script type="text/javascript" src="ext/examples/ux/gridfilters/menu/RangeMenu.js"></script>
    <script type="text/javascript" src="ext/examples/ux/gridfilters/menu/ListMenu.js"></script>
    <script type="text/javascript" src="ext/examples/ux/gridfilters/GridFilters.js"></script>
    <script type="text/javascript" src="ext/examples/ux/gridfilters/filter/Filter.js"></script>
    <script type="text/javascript" src="ext/examples/ux/gridfilters/filter/StringFilter.js"></script>
    <script type="text/javascript" src="ext/examples/ux/gridfilters/filter/DateFilter.js"></script>
    <script type="text/javascript" src="ext/examples/ux/gridfilters/filter/ListFilter.js"></script>
    <script type="text/javascript" src="ext/examples/ux/gridfilters/filter/NumericFilter.js"></script>
    <script type="text/javascript" src="ext/examples/ux/gridfilters/filter/BooleanFilter.js"></script>

  2. #152
    Sencha User
    Join Date
    Nov 2010
    Posts
    54
    Vote Rating
    0
    leowyatt is on a distinguished road

      0  

    Default


    Cheers Condor it didn't even click this was all in the examples directory. I'd added the file manually but seems things weren't right as once I copied your code over and put in the correct paths it worked perfectly.

  3. #153
    Sencha User
    Join Date
    May 2007
    Posts
    113
    Vote Rating
    1
    Fabyo is on a distinguished road

      0  

    Default


    how do I clear the fields of search?
    using clearFilters(), it only cleans the headlines, but what was typed in the search still continues in the fields, how do I clear all fields of search?

    grid.jpg

    thanks

  4. #154
    Touch Premium Member msinn's Avatar
    Join Date
    Jul 2009
    Location
    in front of my pc
    Posts
    280
    Vote Rating
    5
    msinn is on a distinguished road

      0  

    Default


    Quote Originally Posted by Fabyo View Post
    how do I clear the fields of search?
    using clearFilters(), it only cleans the headlines, but what was typed in the search still continues in the fields, how do I clear all fields of search?
    thanks
    Hi, try this:

    PHP Code:

    Ext
    .override(Ext.ux.grid.GridFilters, {
      
    clearFilters : function () {
        
    this.filters.each(function (filter) {
          
    filter.setValue('');
          
    //or filter.setValue(null);
         
    filter.setActive(false);
        });
      } 
    }); 
    First I would like to thank you for your time and knowledge

    Win 7 Ext JS 4.1.3 IE(6-9), FF17

  5. #155
    Sencha User
    Join Date
    May 2007
    Posts
    113
    Vote Rating
    1
    Fabyo is on a distinguished road

      0  

    Default


    Thank you



  6. #156
    Sencha User
    Join Date
    Jun 2008
    Posts
    69
    Vote Rating
    0
    pouniok is on a distinguished road

      0  

    Default


    Hi,

    I've found a change Between Ext 3.1.1 GridFilters.js and Ext 3.3.0 GridFilters.js :

    In function addFilters, line 575 has changed
    PHP Code:
    from filter.type filter.type || this.store.fields.get(dI).type;
    to filter.type filter.type || this.store.fields.get(dI).type.type
    And I was wondering if it was volumtary ?

  7. #157
    Sencha User filippo.ferrari's Avatar
    Join Date
    Apr 2010
    Location
    Sanremo - Italy
    Posts
    126
    Vote Rating
    1
    filippo.ferrari has a reputation beyond repute filippo.ferrari has a reputation beyond repute filippo.ferrari has a reputation beyond repute filippo.ferrari has a reputation beyond repute filippo.ferrari has a reputation beyond repute filippo.ferrari has a reputation beyond repute filippo.ferrari has a reputation beyond repute filippo.ferrari has a reputation beyond repute filippo.ferrari has a reputation beyond repute filippo.ferrari has a reputation beyond repute filippo.ferrari has a reputation beyond repute

      0  

    Default


    A question related to grid filtering: how to configure a remote data source with a store for list filter?

    I've not understand this:

    "If the data for the list is remote, use the {@link #store} config instead."

  8. #158
    Touch Premium Member msinn's Avatar
    Join Date
    Jul 2009
    Location
    in front of my pc
    Posts
    280
    Vote Rating
    5
    msinn is on a distinguished road

      0  

    Default


    Quote Originally Posted by filippo.ferrari View Post
    A question related to grid filtering: how to configure a remote data source with a store for list filter?

    I've not understand this:

    "If the data for the list is remote, use the {@link #store} config instead."
    Hi,

    first you have to configure a store for your filter:

    PHP Code:

    var storeFilter = new Ext.data.JsonStore({
            
    storeId'yourStoreId',
            
    autoLoadfalse,//or as you need it
            
    proxy: new Ext.data.HttpProxy({
                
    url'database.php'
            
    }),
            
    root'rows',
            
    fields: [ 'id''text'//it is important to have the fields named as 'id' and 'text'
        
    }); 
    Then

    PHP Code:

     
    var gridFilter= new Ext.ux.grid.GridFilters({
            
    menuFilterText'Filter',
            
    filters:[{type'string',  dataIndex'NAME'}
                    ,{
    type'list'dataIndex:'STATE'store:storeFilterphpMode:true//your case
            
    ]}); 
    In your grid load script you need to have something like this(here for PHP):

    PHP Code:

    <?php
     $where 
    " 0 = 0 "
     if (
    is_array($filter)) {
         for (
    $i=0;$i<count($filter);$i++){
             switch(
    $filter[$i]['data']['type']){
                 case 
    'string' $qs .= " AND ".$filter[$i]['field']." LIKE '%".$filter[$i]['data']['value']."%'"; break;
                 case 
    'list' :
                     if (
    strstr($filter[$i]['data']['value'],',')){
                         
    $fi explode(',',$filter[$i]['data']['value']);
                         for (
    $q=0;$q<count($fi);$q++){
                             
    $fi[$q] = "'".$fi[$q]."'";
                         }
                         
    $filter[$i]['data']['value'] = implode(',',$fi);
                         
    $qs .= " AND ".$filter[$i]['field']." IN (".$filter[$i]['data']['value'].")";
                     }else{
                         
    $qs .= " AND ".$filter[$i]['field']." = '".$filter[$i]['data']['value']."'";
                     }
                 Break;
                 case 
    'boolean' $qs .= " AND ".$filter[$i]['field']." = ".($filter[$i]['data']['value']); break;
                 case 
    'numeric' :
                     switch (
    $filter[$i]['data']['comparison']) {
                         case 
    'ne' $qs .= " AND ".$filter[$i]['field']." != ".$filter[$i]['data']['value']; break;
                         case 
    'eq' $qs .= " AND ".$filter[$i]['field']." = ".$filter[$i]['data']['value']; break;
                         case 
    'lt' $qs .= " AND ".$filter[$i]['field']." < ".$filter[$i]['data']['value']; break;
                         case 
    'gt' $qs .= " AND ".$filter[$i]['field']." > ".$filter[$i]['data']['value']; break;
                     }
                 break;
                 case 
    'date' :
                     switch (
    $filter[$i]['data']['comparison']) {
                         case 
    'ne' $qs .= " AND ".$filter[$i]['field']." != '".date('Y-m-d',strtotime($filter[$i]['data']['value']))."'"; break;
                         case 
    'eq' $qs .= " AND ".$filter[$i]['field']." = '".date('Y-m-d',strtotime($filter[$i]['data']['value']))."'"; break;
                         case 
    'lt' $qs .= " AND ".$filter[$i]['field']." < '".date('Y-m-d',strtotime($filter[$i]['data']['value']))."'"; break;
                         case 
    'gt' $qs .= " AND ".$filter[$i]['field']." > '".date('Y-m-d',strtotime($filter[$i]['data']['value']))."'"; break;
                     }
                 Break;
             }
         }
         
    $where .= $qs;
     }
    First I would like to thank you for your time and knowledge

    Win 7 Ext JS 4.1.3 IE(6-9), FF17

  9. #159
    Sencha User filippo.ferrari's Avatar
    Join Date
    Apr 2010
    Location
    Sanremo - Italy
    Posts
    126
    Vote Rating
    1
    filippo.ferrari has a reputation beyond repute filippo.ferrari has a reputation beyond repute filippo.ferrari has a reputation beyond repute filippo.ferrari has a reputation beyond repute filippo.ferrari has a reputation beyond repute filippo.ferrari has a reputation beyond repute filippo.ferrari has a reputation beyond repute filippo.ferrari has a reputation beyond repute filippo.ferrari has a reputation beyond repute filippo.ferrari has a reputation beyond repute filippo.ferrari has a reputation beyond repute

      0  

    Default


    Ok, great. I'll test it.

    One note, this: labelField: 'name' override the name 'text' for display name of data in my store, it's true? (I've a store already and I want to reuse it)

  10. #160
    Touch Premium Member msinn's Avatar
    Join Date
    Jul 2009
    Location
    in front of my pc
    Posts
    280
    Vote Rating
    5
    msinn is on a distinguished road

      0  

    Default


    Quote Originally Posted by filippo.ferrari View Post
    Ok, great. I'll test it.

    One note, this: labelField: 'name' override the name 'text' for display name of data in my store, it's true? (I've a store already and I want to reuse it)
    STATE ist the dataIndex config option of your Column which is bound to your field name of the store record (grid store), so the filter is just bound to it too. Your filter send to your grid load script STATE. Play a little bit with firebug and you'll see exactly how the filter parameters are sent.
    First I would like to thank you for your time and knowledge

    Win 7 Ext JS 4.1.3 IE(6-9), FF17

Thread Participants: 84

  1. VinylFox (1 Post)
  2. galdaka (2 Posts)
  3. Condor (10 Posts)
  4. cgi-bin (4 Posts)
  5. Fabyo (8 Posts)
  6. fshort (1 Post)
  7. digitalkaoz (1 Post)
  8. steffenk (2 Posts)
  9. brookd (1 Post)
  10. jamie.nicholson (1 Post)
  11. sawan (1 Post)
  12. froamer (1 Post)
  13. jaquet (1 Post)
  14. KevinChristensen (1 Post)
  15. bernd01 (2 Posts)
  16. tonedeaf (7 Posts)
  17. seg (1 Post)
  18. calavera (5 Posts)
  19. httpdotcom (1 Post)
  20. Timido (3 Posts)
  21. mfrancey (1 Post)
  22. WixSL (1 Post)
  23. drieraf (1 Post)
  24. nickweavers (2 Posts)
  25. goofy (1 Post)
  26. mynameisyoda (1 Post)
  27. manilodisan (1 Post)
  28. eyetv (1 Post)
  29. renoye (3 Posts)
  30. pouniok (2 Posts)
  31. mcouillard (6 Posts)
  32. Scorpie (1 Post)
  33. wiznia (1 Post)
  34. fulfowi (2 Posts)
  35. benmclendon (1 Post)
  36. roemisch (2 Posts)
  37. zeruyo (1 Post)
  38. dizor (1 Post)
  39. SunWuKung (5 Posts)
  40. mx_starter (1 Post)
  41. jimtyp (2 Posts)
  42. nitingautam (1 Post)
  43. westy (2 Posts)
  44. slemiere (1 Post)
  45. mike2406 (2 Posts)
  46. msinn (12 Posts)
  47. RanmaSaotome (1 Post)
  48. cnicolas (2 Posts)
  49. lsaffre (1 Post)
  50. astraschedule (1 Post)
  51. hankin (2 Posts)
  52. mrinaljena (1 Post)
  53. dtex-lab (1 Post)
  54. yohnan (2 Posts)
  55. Override (2 Posts)
  56. hjones (1 Post)
  57. hexawing (1 Post)
  58. taronja (6 Posts)
  59. asbestos girl (7 Posts)
  60. stalek (1 Post)
  61. mpawlowski (1 Post)
  62. DerSalz (1 Post)
  63. jimm (1 Post)
  64. blueberrymuffins (2 Posts)
  65. gleskinen (1 Post)
  66. pmdarrow (1 Post)
  67. Fallen Zen (1 Post)
  68. filippo.ferrari (6 Posts)
  69. george4rotech (2 Posts)
  70. Ebpo (1 Post)
  71. Reimius (1 Post)
  72. webtime (9 Posts)
  73. Christiand (1 Post)
  74. Oliver Specht (1 Post)
  75. novaku (1 Post)
  76. sizemorew (1 Post)
  77. # eof (1 Post)
  78. ldonofrio (3 Posts)
  79. david777 (1 Post)
  80. ExTriqui (4 Posts)
  81. leowyatt (7 Posts)
  82. JSassy (1 Post)
  83. hachie (1 Post)
  84. radmila80 (1 Post)