lsmith / yui3

YUI 3.x Source Tree
http://developer.yahoo.com/yui/3/
Other
7 stars 0 forks source link

Migrate recordset-filter #10

Closed lsmith closed 11 years ago

lsmith commented 12 years ago

See what needs to be done to get filtering functionality currently in recordset-filter into the ML implementation for DT. ML has a filter() implementation, so I suspect this will do the job. If so, should this be an auto-mix()ed class extension to relay a filter() method to this.data.filter(<input>)?

perekstrom commented 12 years ago

One suggestion regarding filters, please bear in mind that I'm a complete YUI noob, so might be suggesting the wrong things here, but...

Personally I love to be able to turn off JavaScript, and I disliked the way DT worked in 3.3 where you couldn't point to an already existing plain old HTML table and transform it into a datatable. Therefore I made my own code to convert a regular HTML table to a datatable using examples and stuff.

This might be rather oldschool of me, but one of my goals when I make homepages is to make all JavaScript secondary - that is, the page works perfectly fine even without JS turned on. One of the best tricks to do this IMO is to use classes to initiate generic JS Objects (such as defining <table class="datatable"> to be converted to a YUI Datatable upon page load).

One thing that would make my life easier would be a way to define a "quick and dirty" keyword filter where you can choose which columns to filter on and the keyword to filter. Ponder that you have a webstore with a table of your products consisting of five values; id,name,value,purchase and image. Now ponder I want to search for all products containing "cat" in the name. My suggestion here is that you can define a filter like this:

var keyword="cat"; var fields=['id','name','value']; DTObj.filter(keyword,fields);

This would be the most basic filter of course, but I think it'd be very newbie-friendly and then having more advanced filters would be great for more advanced uses.