Ext


Go Back   Ext JS Forums > Ext JS Community Forums (2.0) > Ext 2.x: User Extensions and Plugins

Reply
 
Thread Tools
  #1  
Old 10-05-2007, 09:36 PM
ambience's Avatar
ambience ambience is offline
Ext User
 
Join Date: Mar 2007
Location: Denver, CO
Posts: 135
ambience is on a distinguished road
Send a message via AIM to ambience Send a message via MSN to ambience Send a message via Yahoo to ambience
Default Grid Filter (Plugin)

Moderator edit: There's a 3.x version in svn now for those interested, click here.

Example: http://ccinct.com/lab/filter-grid/

I am excited to hear that a number of people have started using / extending the filters. If you have an extension (like some sort of panel based filter configuration) PM me with a link to the related thread and I will link it here. Thanks to every one who has helped bang out bugs and assisted newer users.

Also, I would like to credit ControlPath, the company that pays for my time =) The filters were developed to support an ongoing effort to transition the product to a 100% Ext UI and they were kind enough to let me share the code with you guys.

Server Side Code
Due to copyright issues I cannot share my implementation of the server side code (written in Java), and the PHP is to entangled in a bigger framework / hacked together to share. If you have an implementation you would like to share, PM me with the files and I will link them here.

PHP
Ruby on Rails
Python
Grails
Initial Release
  • Grid filters now function as a plugin for the grid. As a result you can use them in conjunction with custom views (like grouping).
  • List filters are now much more robust in that you can provide them with a Ext.data.Store to load their options the first time they are shown.
  • This version does not have a a dynamic loader included, read the source to find out where to put yours (documented).
  • The way filters are configured has changed ever so slightly.
  • Now 100% Ext (Prototype-free).

Version 0.2
  • Local filtering can now be enabled by passing the 'local: true' as a config value
  • Fixed some of the filters setValue functions.
  • Stateful mode can now be enabled by passing a string value for the config option 'stateId'. This may be updated in the next Ext code push to store this information when the grid saves/restores its state. However, the events required are not part of the current beta (I think they are in SVN however)
  • Add an 'autoReload' field / config option that defaults to true. Set this to false if you wish to prevent the datastore from being reloaded when you make changes to the filters.

Version 0.2.1 (Minor update, thanks for the feedback)
Bug Fixes
  • Date filters will disable conflicting date ranges [Thanks hendricd]
  • Added missing super constructor line to Filter [Thanks hendricd]
  • Boolean filters now use uniqu radio group IDs (so you can have more then one!) [Thanks olive38]

Enhancements
  • Added a 'serialize' event to the Filter class. Using this you can attach additional parameters to serialization data before it is encoded and sent to the server.
  • You can pass the GridFilters object as a plugin to the paging toolbar and it will reset the page to 1 whenever you update the filters.
  • Boolean filters take a defaultValue config parameter. Set this to null if you do not want either option to be checked by default.

Version 0.2.2, 0.2.3, 0.2.4, 0.2.5
Bug Fixes
  • Fixed an issue with numeric fields displaying "NaN" initially in RC1 [Thanks JeffHowden]
  • Fixed an issue with filter application in the absence of request options [Thanks JorisA]
  • Date format is now forwarded to the date selectors [Thanks hendricd]
  • Small bug fix with filters being activated before a load event on grids with the filters used as a plug in to the paging tool bar *inhale* [Thanks hendricd]
  • Fixed a global namespace leak. [Thanks hendricd]
  • Reload now cancels the deferred update. [Thanks ericwaldheim]
  • Local string filtering is now case insensitive . [Thanks robasi]

Version 0.2.6
Bug Fixes
  • Removed a console.log in applyState(), oops >.<

Enhancments
  • The filter collection will now bind to the 'beforestaterestore' and 'beforestatesave' events in order to be stateful. Set your stateId on the associated grid.
  • Future versions will now include the version number in the header of GridFilters.js for your convenience

Version 0.2.7 June 4th, 2008
Enhancments
  • Add some localization support (post) [Thanks wm003]
  • Tweeked EditableItem to have better icon support (post) [Thanks AlxH]
  • Added green tinted column header graphics and CSS classes for filtered columns
  • Icons are now all defined as styles in the resources/style.css file. You'll need to link to this in order to have them and get the new column header style. (no more need for prototype changes)

Version 0.2.8 August 22nd, 2008
Enhancments
  • Refactored ListFilter.js to use a new Ext.ux.menu.ListMenu component.
  • I've included Ext.ux.menu.TreeMenu, I can't really offer allot of support for it, but it's what we use for tree filters.

Bug Fixes
  • Fixed text selection and general carrot wonkyness in Firfox [Big Thanks to Steffen Hiller]
  • You can now use apostrophes in Firefox 3 o.O
Attached Files
File Type: zip source.zip (16.0 KB, 3117 views)
File Type: zip 0.2.7.zip (17.3 KB, 877 views)
File Type: zip 0.2.8.zip (19.3 KB, 2594 views)
Reply With Quote
  #2  
Old 10-06-2007, 03:53 AM
krycek's Avatar
krycek krycek is offline
Ext User
 
Join Date: Jun 2007
Posts: 94
krycek is on a distinguished road
Default


Perfect. I can't imagine a better way to do that.
But I think I've found a bug, try to do as follow:
1. Resize the width of one column making the last column not visible on the grid panel (a horizontal scrollbar will be shown)
2. Go to the second page
3. Create a filter in the "Visible" column to show just "No" visibles records

After doing that I can't remove this filter anymore because the scrollbar is gone and the grid will no longer show any data because I'm on the second page that has no records.

In this particulary case, going back to the first page after any filtering, solves the problem. But what if after setting a filter on the last column made the grid show no records? In this case I wouldn't be able to remove the filter anymore.
Reply With Quote
  #3  
Old 10-06-2007, 05:18 AM
ejetorix's Avatar
ejetorix ejetorix is offline
Ext User
 
Join Date: Mar 2007
Location: Spain, EU
Posts: 19
ejetorix is on a distinguished road
Send a message via MSN to ejetorix
Thumbs up

Fantastic job Ambience.

BTW, problems like krycek has noticed, are the reason for what i prefer a separate panel/region/whatever for filtering, instead of rendering it on columns menu.

Thank you for porting it to 2.0 branch in so little time.
Reply With Quote
  #4  
Old 10-06-2007, 05:25 AM
Foggy's Avatar
Foggy Foggy is offline
Ext JS Premium Member
 
Join Date: Apr 2007
Location: Switzerland
Posts: 459
Foggy is on a distinguished road
Default

Excellent work, thanks for sharing
Reply With Quote
  #5  
Old 10-06-2007, 08:18 AM
6epcepk 6epcepk is offline
Ext User
 
Join Date: Jul 2007
Location: Moscow, Russia
Posts: 289
6epcepk is on a distinguished road
Send a message via ICQ to 6epcepk
Default

Waiting for beta-version =)
Thanks!
Reply With Quote
  #6  
Old 10-06-2007, 02:53 PM
ambience's Avatar
ambience ambience is offline
Ext User
 
Join Date: Mar 2007
Location: Denver, CO
Posts: 135
ambience is on a distinguished road
Send a message via AIM to ambience Send a message via MSN to ambience Send a message via Yahoo to ambience
Default

Quote:
Originally Posted by krycek View Post
In this particulary case, going back to the first page after any filtering, solves the problem. But what if after setting a filter on the last column made the grid show no records? In this case I wouldn't be able to remove the filter anymore.
I agree that this is a problem. However I think that it may also be a small shortcoming in the base grid widget. I believe that a scrollbar should be present if the headers exceed the current view port and there is no data. I may be able to convince the paging tool bar to go to the first page by firing the appropriate events on the store when the filter configuration has changed and will look into that.

As a small work around, you could add a 'clear filters' button to your paging tool bar and bind its handler to filters.clearFilters(). If you wanted to get even more fancy, you could build a menu button that had items for each of the configured filters. I will add a 'filteradded' event to the GridFilters to help facilitate this.

Thanks for the feedback.
Reply With Quote
  #7  
Old 10-06-2007, 04:09 PM
jack.slocum's Avatar
jack.slocum jack.slocum is offline
Ext JS - Development Team
 
Join Date: Mar 2007
Posts: 6,941
jack.slocum is on a distinguished road
Default

Great work ambience. Thank you for sharing, I am sure there are many who will find this useful!
__________________
Jack Slocum
Ext JS - Core Development Team
jack@extjs.com
Reply With Quote
  #8  
Old 10-06-2007, 05:29 PM
franklt69 franklt69 is offline
Ext User
 
Join Date: Mar 2007
Posts: 652
franklt69 is on a distinguished road
Send a message via Yahoo to franklt69
Default

very cool the filter, is there any way to do filter in the side client only for instance or it is only to server side?

regards
Frank
Reply With Quote
  #9  
Old 10-07-2007, 07:30 AM
osamaao osamaao is offline
Ext User
 
Join Date: Sep 2007
Posts: 1
osamaao is on a distinguished road
Default I need help

Hello,

Thanks for this nice filter feature.
I have a question please, I am new to extjs and I am trying to make an example running, I am using your filter-grid, DWR and Spring.

The problem is that I can't read the filter parameter on the Java side.. I am not sure of the parameter name. shouldn't it be "filters"?

Appreciating your help.
Reply With Quote
  #10  
Old 10-07-2007, 02:55 PM
ambience's Avatar
ambience ambience is offline
Ext User
 
Join Date: Mar 2007
Location: Denver, CO
Posts: 135
ambience is on a distinguished road
Send a message via AIM to ambience Send a message via MSN to ambience Send a message via Yahoo to ambience
Default

By default the field is 'filter', with out the 's'. But that is configurable with the 'paramPrefix' confg option. For example:
    plugins: new Ext.ux.grid.GridFilters({paramPrefix: 'omgBearIsDriving'});
Additionally, the filter param will be expressed as an array of objects for example:
filter[0][data][type]=string
filter[0][data][value]=Geek
filter[0][field]=name
filter[1][data][type]=list
filter[1][data][value]=medium,large,extra large
filter[1][field]=size
If you wish to change how the data is structured and sent to the server you can either extend GridFilters and overload the 'buildQuery' function or pass a new function as config option:

    plugins: new Ext.ux.grid.GridFilters({
        buildQuery: function(filters){
                var p = {};
		for(var i=0, len=filters.length; i<len; i++){
                    // Custom filter serialization
		}
		
		return p;
        }
    });
Reply With Quote
Reply

Thread Tools

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

All times are GMT -5. The time now is 09:49 PM.

© 2006-2009 Ext, LLC
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.