Skip Menu |

This queue is for tickets about the Maypole-Plugin-QuickTable CPAN distribution.

Report information
The Basics
Id: 13793
Status: resolved
Priority: 0/
Queue: Maypole-Plugin-QuickTable

People
Owner: Nobody in particular
Requestors: davekam [...] pobox.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: display of has_many columns is broken in new tabulate
I inserted the following for debugging at line 168 in _tabulate: use Data::Dumper; print STDERR Dumper($cols); my @blah = map { $object->$_ } @$cols; print STDERR Dumper(@blah); It produces the following results: $VAR1 = [ 'table_id', 'ref', 'description', 'num_items', 'm_time', 'items' ]; $VAR1 = [ 'table_id', 'ref', 'description', 'num_items', 'm_time', 'items' ]; $VAR1 = '3'; $VAR2 = 'blibble'; $VAR3 = 'blabble'; $VAR4 = '0'; $VAR5 = bless( [ 27, 5, 17, 18, 6, 105, 1, 198, 0, undef, 0, 0 ], 'Time::Piece' ); In other words, the items field vanishes entirely, presumably because $object->$_ is returning undef or an empty array. In my database as it currently stands there are not yet any items. Presumably if there were, _tabulate() would work ok. But in the case where there are none, it produces a big problem because an entire column is missing from the resulting HTML table, causing misalignment. This is, perhaps, yet another argument for forced stringification (see #13778). BTW, I'm not so sure if it's a good idea to include _all_ related items in a case like this (there could be dozens or even hundreds or thousands), although I certainly appreciate the added functionality and speed with which the general issue (tabulate always assuming display_columns) was resolved.
[guest - Wed Jul 20 09:15:11 2005]: Show quoted text
> I inserted the following for debugging at line 168 in _tabulate: > > use Data::Dumper; > print STDERR Dumper($cols); > my @blah = map { $object->$_ } @$cols; > print STDERR Dumper(@blah); > > It produces the following results: > > $VAR1 = [ > 'table_id', > 'ref', > 'description', > 'num_items', > 'm_time', > 'items' > ]; > > $VAR1 = [ > 'table_id', > 'ref', > 'description', > 'num_items', > 'm_time', > 'items' > ]; > $VAR1 = '3'; > $VAR2 = 'blibble'; > $VAR3 = 'blabble'; > $VAR4 = '0'; > $VAR5 = bless( [ > 27, > 5, > 17, > 18, > 6, > 105, > 1, > 198, > 0, > undef, > 0, > 0 > ], 'Time::Piece' ); > > In other words, the items field vanishes entirely, presumably because > $object->$_ is returning undef or an empty array. In my database as > it currently stands there are not yet any items. Presumably if > there were, _tabulate() would work ok. But in the case where there > are none, it produces a big problem because an entire column is > missing from the resulting HTML table, causing misalignment. This > is, perhaps, yet another argument for forced stringification (see > #13778). > > BTW, I'm not so sure if it's a good idea to include _all_ related > items in a case like this (there could be dozens or even hundreds > or thousands), although I certainly appreciate the added > functionality and speed with which the general issue (tabulate > always assuming display_columns) was resolved.
This is fixed in QT 0.3. Empty columns are turned into an empty string rather than an empty list, so the table cell gets rendered and the columns stay in sync. Muliple returns are transformed into a single list to go in the table cell. The templates are intended to be a starting point. Wherever sensible and useful default behaviour can be identified, I want to include it, but some things depend entirely on the application. Having said that, I think the tabulate() method needs a lot more flexibility. It's easy to override how a field is rendered in CDBI::FB, but not in tabulate(), so expect that to evolve, and send me any suggestions you have. d.