Filter for Tables

Hello,

I’m not sure if this topic has already been dealt with, if so, please forgive me, I couldn’t find one.

I’m looking for a Filter Function/Action for Tables. Basically, what I want to do is this: http://www.calvarycch.org/ccch/media_center.php

What options would I have to accomplish this?

Thanks for your help,

Hannes


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I’ve never made one this complex, but I have made filters that act on
everything in the row of a table or similar. The basic technique is
pretty simple. You make a form field, give it an ID (Freeway doesn’t
do that by default), give your table an ID, and then add Protaculous
to the page. Pate the following in the top Function Body dialog,
making sure to adjust the variable names to match your real IDs, and
you should be all set:

This script takes all of the text in each row, mooshes it together
into a data variable, and then stores that in your page (in an
invisible manner). Whenever you type in the “filter” box, the script
loops through all of the entries in this little database, and shows or
hides the table rows as appropriate.

It’s not as full-featured as your example, but then it also allows for
any form of search that your user can imagine, rather than being
restricted to various degrees of difference.

Walter

On Nov 1, 2010, at 12:59 PM, Johannes Bremicker wrote:

Hello,

I’m not sure if this topic has already been dealt with, if so,
please forgive me, I couldn’t find one.

I’m looking for a Filter Function/Action for Tables. Basically, what
I want to do is this: http://www.calvarycch.org/ccch/media_center.php

What options would I have to accomplish this?

Thanks for your help,

Hannes


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hey Walter,

thanks for your always faithful replies.
I think I understand what you want me to do, but it doesn’t work yet. I tried but somewhere there is again this problem of language, trying to exaclty grasp what you mean and then applying it to a software with different language.

The easiest way again would probably be, if you would be so gracious and just create an example with a three row table and a filter along with protaculous, including your code up there. This way, I can study the real deal without being totally frustrated and for you it would be not so much work to explain either.

hope thats fine with you, you helped me a lot with that method last time.

Greetings from Germany,

Hannes


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

No trouble. http://scripty.walterdavisstudio.com/filter.freeway.zip

Be sure to install the latest version of Protaculous – released today
– before you open this file.

Walter

On Nov 2, 2010, at 2:46 PM, Johannes Bremicker wrote:

Hey Walter,

thanks for your always faithful replies.
I think I understand what you want me to do, but it doesn’t work
yet. I tried but somewhere there is again this problem of language,
trying to exaclty grasp what you mean and then applying it to a
software with different language.

The easiest way again would probably be, if you would be so gracious
and just create an example with a three row table and a filter along
with protaculous, including your code up there. This way, I can
study the real deal without being totally frustrated and for you it
would be not so much work to explain either.

hope thats fine with you, you helped me a lot with that method last
time.

Greetings from Germany,

Hannes


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hey Walter!

It works. Thanks! How come, it always works when I just paste your code etc. to my page? It seems everytime, there is just a little mistake somewhere!
Anyway, great help, great community, great software!

Greetings,

Johannes


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hey again,

Walter, what do I have to change in the Protaculous Code, if instead of a Text-Field I would want to use a Menue/List?

Greetings and Thanks,

Johannes


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

You would change a couple of things. First, in Freeway, you would
select your picking list and apply the FormFix Action to it. Freeway
does a couple of things wrong with respect to picking lists, and this
fixes them. You set the ID that you want your picker to have in the
Name field in the Inspector, and the Action takes care of applying
that ID and also fixing up some glitches in the way that Freeway
generates the picking list control.

Second, you would need to make sure when you make that picker that you
fill in the Value side of the interface, not just the Choice side (in
the Inspector, third tab from the left when the picking list is
selected).

Finally, you would need to change the event that the script observes.
Where it currently checks on ‘keyup’, you would switch that to
‘change’. So this line:

 filter.observe('keyup', function(e) {

becomes

 filter.observe('change', function(e) {

I’m pretty sure that will do the trick. The only thing to remember is
that this filter only looks for text that is in your table, so
whatever you enter in the Value side of each picking list option will
have to be present in the text within the table in order for the row
to show. Also, the picker needs a neutral “All” option as its default,
with no value.

Walter

On Nov 10, 2010, at 2:55 PM, Johannes Bremicker wrote:

Hey again,

Walter, what do I have to change in the Protaculous Code, if instead
of a Text-Field I would want to use a Menue/List?

Greetings and Thanks,

Johannes


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

It did! Wow, first time I made it with your description only! :wink: Thanks Walter!

Talk to you next problem!

Johannes


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Question for Walter: Is there a way to exclude table head from the filter? I’m hodge-podging your script, a WebYep table (coeditor) and: http://www.kryogenix.org/code/browser/sorttable/.

However, when I filter the table using the form field, it filters out the head’s rows, which I don’t like.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Nevermind, I simply had to add tbody to the first line of the script, like so:
var list = $$(“#yourDataTable tbody tr”);


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options