You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Poko Booth <po...@gmail.com> on 2010/11/25 14:17:29 UTC

Invalid html rendered with DataTable [ex. empty tfoot element]

Hi all,
If you use DataTables, when the bottomToolBars view has no items to render,
the markup exported is invalid:

<table>
      <thead> </thead>
      <tfoot> </tfoot>
      <tbody>
           ...
           ...
      </tbody>
</table>

I suppose the same happens with the thead.

thead and tfoot tags can't be empty.

I have overridden the class and manually added in the markup file
<tr style="display: none;"><td></td></tr>
in both thead and tfoot of the source file above the <wicket:container ...>
tags.

Works but you know....Not elegant.

Enclosure containers should be used on the thead/tfoot tags defining their
children as the top/bottom toolbar repeating views.

Regards,
Poko

Re: Invalid html rendered with DataTable [ex. empty tfoot element]

Posted by Martin Grigorov <mg...@apache.org>.
Here is the patch:

diff --git
a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/DataTable.html
b/wicket-extensions/src/main/java/org/apache/wicket/ext
index 8b3ab5b..f19673f 100644
---
a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/DataTable.html
+++
b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/DataTable.html
@@ -17,12 +17,16 @@
 -->
 <wicket:panel>

+<wicket:enclosure child="topToolbars">
 <thead>
        <wicket:container wicket:id="topToolbars"></wicket:container>
 </thead>
+</wicket:enclosure>
+<wicket:enclosure child="bottomToolbars">
 <tfoot>
        <wicket:container wicket:id="bottomToolbars"></wicket:container>
 </tfoot>
+</wicket:enclosure>
 <tbody wicket:id="body">
        <tr wicket:id="rows">
                <td wicket:id="cells">
diff --git
a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/DataTable.java
b/wicket-extensions/src/main/java/org/apache/wicket/ext
index 440c466..9cc1e50 100644
---
a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/DataTable.java
+++
b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/DataTable.java
@@ -455,5 +455,14 @@ public class DataTable<T> extends Panel implements
IPageableItems
                {
                        super(id);
                }
+
+               @Override
+               public void onConfigure()
+               {
+                       super.onConfigure();
+                       setVisible(iterator().hasNext());
+               }
+
+
        }
 }

Please try it and if it works for you then I'll apply it.

On Tue, Dec 14, 2010 at 6:00 PM, Alexander Morozov <
alexander.v.morozov@gmail.com> wrote:

>
> 1. create patch and send it to JIRA :)
> 2. apply transformer behavior to a table component
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Invalid-html-rendered-with-DataTable-ex-empty-tfoot-element-tp3058934p3087508.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Invalid html rendered with DataTable [ex. empty tfoot element]

Posted by Alexander Morozov <al...@gmail.com>.
1. create patch and send it to JIRA :)
2. apply transformer behavior to a table component

-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Invalid-html-rendered-with-DataTable-ex-empty-tfoot-element-tp3058934p3087508.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Invalid html rendered with DataTable [ex. empty tfoot element]

Posted by Nelson Segura <ns...@gmail.com>.
The same problem is visible in the Wicket examples for data table

http://wicketstuff.org/wicket14/repeater/?wicket:bookmarkablePage=:org.apache.wicket.examples.repeater.DataTablePage

The tfoot tags are empty, which is invalid HTML.

Any ideas on how to fix this?

-Nelson

On Thu, Nov 25, 2010 at 6:51 PM, Poko Booth <po...@gmail.com> wrote:

> I'm using 1.4.12
>
> Regards,
> Poko
>
> On Nov 25, 2010, at 9:28 PM, Igor Vaynberg wrote:
>
> > mind specifying which wicket version you are using?
> >
> > -igor
> >
> > On Thu, Nov 25, 2010 at 5:17 AM, Poko Booth <po...@gmail.com>
> wrote:
> >> Hi all,
> >> If you use DataTables, when the bottomToolBars view has no items to
> render,
> >> the markup exported is invalid:
> >>
> >> <table>
> >>      <thead> </thead>
> >>      <tfoot> </tfoot>
> >>      <tbody>
> >>           ...
> >>           ...
> >>      </tbody>
> >> </table>
> >>
> >> I suppose the same happens with the thead.
> >>
> >> thead and tfoot tags can't be empty.
> >>
> >> I have overridden the class and manually added in the markup file
> >> <tr style="display: none;"><td></td></tr>
> >> in both thead and tfoot of the source file above the <wicket:container
> ...>
> >> tags.
> >>
> >> Works but you know....Not elegant.
> >>
> >> Enclosure containers should be used on the thead/tfoot tags defining
> their
> >> children as the top/bottom toolbar repeating views.
> >>
> >> Regards,
> >> Poko
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Invalid html rendered with DataTable [ex. empty tfoot element]

Posted by Poko Booth <po...@gmail.com>.
I'm using 1.4.12

Regards,
Poko

On Nov 25, 2010, at 9:28 PM, Igor Vaynberg wrote:

> mind specifying which wicket version you are using?
> 
> -igor
> 
> On Thu, Nov 25, 2010 at 5:17 AM, Poko Booth <po...@gmail.com> wrote:
>> Hi all,
>> If you use DataTables, when the bottomToolBars view has no items to render,
>> the markup exported is invalid:
>> 
>> <table>
>>      <thead> </thead>
>>      <tfoot> </tfoot>
>>      <tbody>
>>           ...
>>           ...
>>      </tbody>
>> </table>
>> 
>> I suppose the same happens with the thead.
>> 
>> thead and tfoot tags can't be empty.
>> 
>> I have overridden the class and manually added in the markup file
>> <tr style="display: none;"><td></td></tr>
>> in both thead and tfoot of the source file above the <wicket:container ...>
>> tags.
>> 
>> Works but you know....Not elegant.
>> 
>> Enclosure containers should be used on the thead/tfoot tags defining their
>> children as the top/bottom toolbar repeating views.
>> 
>> Regards,
>> Poko
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Invalid html rendered with DataTable [ex. empty tfoot element]

Posted by Igor Vaynberg <ig...@gmail.com>.
mind specifying which wicket version you are using?

-igor

On Thu, Nov 25, 2010 at 5:17 AM, Poko Booth <po...@gmail.com> wrote:
> Hi all,
> If you use DataTables, when the bottomToolBars view has no items to render,
> the markup exported is invalid:
>
> <table>
>      <thead> </thead>
>      <tfoot> </tfoot>
>      <tbody>
>           ...
>           ...
>      </tbody>
> </table>
>
> I suppose the same happens with the thead.
>
> thead and tfoot tags can't be empty.
>
> I have overridden the class and manually added in the markup file
> <tr style="display: none;"><td></td></tr>
> in both thead and tfoot of the source file above the <wicket:container ...>
> tags.
>
> Works but you know....Not elegant.
>
> Enclosure containers should be used on the thead/tfoot tags defining their
> children as the top/bottom toolbar repeating views.
>
> Regards,
> Poko
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org