From: Matt Kruse on
On Mar 7, 9:21 pm, gandalfrat <gandalf...(a)gmail.com> wrote:
> Can anyone help me out with a problem with Matt Kruse' Javascript
> toolbox script for table sort/filter?

As others have noted, I am here ;)

> 1.  The columns with filters all seem to expand to the width of the
> longest entry in their column.
> 2.  Columns with no filters get the leftovers.

This is just the nature of HTML.

> the th directive seems to be ignored (<th width="60%">Description</
> th>)

Not ignored, just overridden by other things. If you make your font
really, really small or your screen really wide, you'll see that the
description column does indeed take up about 60% of the width.

Unfortunately for you, if you have content in a cell that cannot be
squished or wrapped, the cell _must_ expand to be wide enough to
support the content. Since the select dropdowns are wide and cannot be
wrapped, their columns will always be wide enough to fit them.

Think of it this way - if you were to expand the Description column to
be a full 60% width, what do you think should happen to the other
columns with the wide select dropdowns? Should they scroll? Be
clipped? Should content just disappear?

You do have some options:
1) Change the js source so that the selects cut off the text after an
arbitrary number of characters
2) Put a css width on the selects themselves, causing the remaining
text to be clipped (this won't work in all browsers, btw)
3) Set an explicit width on the TH cells, and set the style
overflow:hidden; so that the cell will not be made wider
4) Change the font size in the select lists using css
5) Switch to text input filters instead of select lists

> PM'd Matt a couple of times, made a donation.  No info.

I get over 1,000 junk mails a day and I have aggressive filters set
up. I also cannot being to respond to all the valid email I get in a
day. If your messages were spammed or not answered, I apologize. I do
try to always answer questions asap from those who are kind enough to
donate ;)

Hope that helps!

Matt Kruse
From: gandalfrat on
Appreciate everyone's input. Lots of things to try. Clearly in a
little over my head. I wanted to use the utility because I couldn't
roll my own. It worked well for simple use cases. This example where
I need a little more control over layout is definitely highlighting
some weaknesses in my understanding of CSS. Thanks for the pointer on
where to take those q's. Thanks too for the details on what to try...
that's really what I needed to get moving again.

Matt Kruse said:

> 3) Set an explicit width on the TH cells, and set the style
> overflow:hidden; so that the cell will not be made wider

ah. the overflow:hidden is why I couldn't get the other cells to
budge. got it.

Matt Kruse said:

> You do have some options:
> 1) Change the js source so that the selects cut off the text after an
> arbitrary number of characters
> 2) Put a css width on the selects themselves, causing the remaining
> text to be clipped (this won't work in all browsers, btw)
> 3) Set an explicit width on the TH cells, and set the style
> overflow:hidden; so that the cell will not be made wider
> 4) Change the font size in the select lists using css
> 5) Switch to text input filters instead of select lists

I was hoping to figure out some way of basing the filter list on a
column of short text ("keys" if you will) but then displaying the long
text (wrapped) in the cells below.

>Think of it this way - if you were to expand the Description column to
>be a full 60% width, what do you think should happen to the other
>columns with the wide select dropdowns? Should they scroll? Be
>clipped? Should content just disappear?

I ended up using Max Gugliemi's script from javascriptkit to pretty
much do that (scrunch pulldowns in other columns) -- his script is
parameter-driven and not stylesheet driven so it was easier to figure
it out. I feel that yours is superior in end-user usability and
provides cleaner output (duh. CSS)... but have to figure out the
styles side of it first.

BTW... if the filter list was a flyout like many menu controls,
couldn't it display long filter list entries over top of the other
columns (long text in the cells below would wrap per column width
settings).

> > PM'd Matt a couple of times, made a donation.  No info.
>
> I get over 1,000 junk mails a day and I have aggressive filters set
> up. I also cannot being to respond to all the valid email I get in a
> day. If your messages were spammed or not answered, I apologize. I do
> try to always answer questions asap from those who are kind enough to
> donate ;)
>
> Hope that helps!
>
> Matt Kruse

Thanks Matt. I didn't look at many of the historical comments on the
usenet group to see that you still frequented this group... (last
"what's new" on JS Toolbox is 5/2009). My comment was less about
your response time (realizing you'd taken down the bulletin board on
your site because it was chewing up too much time) and more about
telling others I'd really followed up with you and didn't have an
answer so I was hoping people wouldn't send me back to RTFM when the M
didn't quite describe my use case.

p.s. the php Excel reader seems to have the same issue with large text
entries (http://code.google.com/p/php-excel-reader/issues/detail?
id=55) but for different reasons.