You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Martin Makundi <ma...@koodaripalvelut.com> on 2014/10/03 17:53:21 UTC

Transpose html table

Hi!

We have a html table in wicket implemented as:

foreach :: listview of table rows {
  ..
  foreach :: list view of table cells {
     ..
  }
}

(note: that was pseudocode)


What we would like to do, is offer users possibility to transpose the
table, however, with minimum changes to the code.

Anybody done this? Any insights?

We acknowledge that there are some inherent differences in the transposed
versions of a html table. For example table rows can be ajax updated but
table columns cannot. This might suggest that a div suitable layout should
be used? Or should we simply
ajaxRequestTarget.addComponent(xx::foreach::firstChildOfRow)  visit each
first child of '*row*' when transposed?

Maybe the transpose could be done using a simple onrender string replace
operation (think along the lines of a "*complex regexp operation*").

Any ideas, comments?

Would be nice to accomplish this with a neat trick... NOT looking for a js
gimmick because that will be slow with our heavy duty tables.

Some references:

   -
   http://assaneonline.blogspot.fi/2011/02/looking-for-simpler-way-to-transpose.html
   -
   http://adomas.eu/transposing-html-table-even-with-colspan-and-rowspan-used-with-jquery-javascript-code/


**
Martin

Re: Transpose html table

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
instead of HTML table using DIV? and with CSS and classes  on div draw a
row vertically or horizontally... Models will be the same only presentation
canges. You will allways have HTM

<div>
<div id="row1" class="row x">
   <div class="cell x"></div>
<div>
<div id="row2" class="row x">
   <div class="cell x"></div>
<div>
<div id="rowN" class="row x">
   <div class="cell x"></div>
<div>
</div>

with class x = horizontal or vertical.

I haven't tried the above but I'm confident it will work.

On Fri, Oct 3, 2014 at 10:55 PM, Martin Makundi <
martin.makundi@koodaripalvelut.com> wrote:

> I'd prefer to do it transparently without changing models and minimal
> (hardcoded) change to components.
>
> **
> Martin
>
> 2014-10-03 23:50 GMT+03:00 Paul Bors <pa...@bors.ws>:
>
> > If you want to "transpose" your table (ie: change the rows and columns)
> > then it turn this implies that you want to change the structure of the
> > table both the format and the model.
> > ie: You need to provide new columns and new data model.
> >
> > You would do so in 2 steps:
> > 1) Create the new table with the new columns
> > 2) Provide it the new data model
> >
> > Then use the addOrReplace("tableId", transposedTableRef) and you're done.
> >
> > Otherwise... look at transposing your table in jQuery alone on the client
> > side and not on the server side.
> >
> > On Fri, Oct 3, 2014 at 11:53 AM, Martin Makundi <
> > martin.makundi@koodaripalvelut.com> wrote:
> >
> > > Hi!
> > >
> > > We have a html table in wicket implemented as:
> > >
> > > foreach :: listview of table rows {
> > >   ..
> > >   foreach :: list view of table cells {
> > >      ..
> > >   }
> > > }
> > >
> > > (note: that was pseudocode)
> > >
> > >
> > > What we would like to do, is offer users possibility to transpose the
> > > table, however, with minimum changes to the code.
> > >
> > > Anybody done this? Any insights?
> > >
> > > We acknowledge that there are some inherent differences in the
> transposed
> > > versions of a html table. For example table rows can be ajax updated
> but
> > > table columns cannot. This might suggest that a div suitable layout
> > should
> > > be used? Or should we simply
> > > ajaxRequestTarget.addComponent(xx::foreach::firstChildOfRow)  visit
> each
> > > first child of '*row*' when transposed?
> > >
> > > Maybe the transpose could be done using a simple onrender string
> replace
> > > operation (think along the lines of a "*complex regexp operation*").
> > >
> > > Any ideas, comments?
> > >
> > > Would be nice to accomplish this with a neat trick... NOT looking for a
> > js
> > > gimmick because that will be slow with our heavy duty tables.
> > >
> > > Some references:
> > >
> > >    -
> > >
> > >
> >
> http://assaneonline.blogspot.fi/2011/02/looking-for-simpler-way-to-transpose.html
> > >    -
> > >
> > >
> >
> http://adomas.eu/transposing-html-table-even-with-colspan-and-rowspan-used-with-jquery-javascript-code/
> > >
> > >
> > > **
> > > Martin
> > >
> >
>



-- 
Regards - Ernesto Reinaldo Barreiro

Re: Transpose html table

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
I'd prefer to do it transparently without changing models and minimal
(hardcoded) change to components.

**
Martin

2014-10-03 23:50 GMT+03:00 Paul Bors <pa...@bors.ws>:

> If you want to "transpose" your table (ie: change the rows and columns)
> then it turn this implies that you want to change the structure of the
> table both the format and the model.
> ie: You need to provide new columns and new data model.
>
> You would do so in 2 steps:
> 1) Create the new table with the new columns
> 2) Provide it the new data model
>
> Then use the addOrReplace("tableId", transposedTableRef) and you're done.
>
> Otherwise... look at transposing your table in jQuery alone on the client
> side and not on the server side.
>
> On Fri, Oct 3, 2014 at 11:53 AM, Martin Makundi <
> martin.makundi@koodaripalvelut.com> wrote:
>
> > Hi!
> >
> > We have a html table in wicket implemented as:
> >
> > foreach :: listview of table rows {
> >   ..
> >   foreach :: list view of table cells {
> >      ..
> >   }
> > }
> >
> > (note: that was pseudocode)
> >
> >
> > What we would like to do, is offer users possibility to transpose the
> > table, however, with minimum changes to the code.
> >
> > Anybody done this? Any insights?
> >
> > We acknowledge that there are some inherent differences in the transposed
> > versions of a html table. For example table rows can be ajax updated but
> > table columns cannot. This might suggest that a div suitable layout
> should
> > be used? Or should we simply
> > ajaxRequestTarget.addComponent(xx::foreach::firstChildOfRow)  visit each
> > first child of '*row*' when transposed?
> >
> > Maybe the transpose could be done using a simple onrender string replace
> > operation (think along the lines of a "*complex regexp operation*").
> >
> > Any ideas, comments?
> >
> > Would be nice to accomplish this with a neat trick... NOT looking for a
> js
> > gimmick because that will be slow with our heavy duty tables.
> >
> > Some references:
> >
> >    -
> >
> >
> http://assaneonline.blogspot.fi/2011/02/looking-for-simpler-way-to-transpose.html
> >    -
> >
> >
> http://adomas.eu/transposing-html-table-even-with-colspan-and-rowspan-used-with-jquery-javascript-code/
> >
> >
> > **
> > Martin
> >
>

Re: Transpose html table

Posted by Paul Bors <pa...@bors.ws>.
If you want to "transpose" your table (ie: change the rows and columns)
then it turn this implies that you want to change the structure of the
table both the format and the model.
ie: You need to provide new columns and new data model.

You would do so in 2 steps:
1) Create the new table with the new columns
2) Provide it the new data model

Then use the addOrReplace("tableId", transposedTableRef) and you're done.

Otherwise... look at transposing your table in jQuery alone on the client
side and not on the server side.

On Fri, Oct 3, 2014 at 11:53 AM, Martin Makundi <
martin.makundi@koodaripalvelut.com> wrote:

> Hi!
>
> We have a html table in wicket implemented as:
>
> foreach :: listview of table rows {
>   ..
>   foreach :: list view of table cells {
>      ..
>   }
> }
>
> (note: that was pseudocode)
>
>
> What we would like to do, is offer users possibility to transpose the
> table, however, with minimum changes to the code.
>
> Anybody done this? Any insights?
>
> We acknowledge that there are some inherent differences in the transposed
> versions of a html table. For example table rows can be ajax updated but
> table columns cannot. This might suggest that a div suitable layout should
> be used? Or should we simply
> ajaxRequestTarget.addComponent(xx::foreach::firstChildOfRow)  visit each
> first child of '*row*' when transposed?
>
> Maybe the transpose could be done using a simple onrender string replace
> operation (think along the lines of a "*complex regexp operation*").
>
> Any ideas, comments?
>
> Would be nice to accomplish this with a neat trick... NOT looking for a js
> gimmick because that will be slow with our heavy duty tables.
>
> Some references:
>
>    -
>
> http://assaneonline.blogspot.fi/2011/02/looking-for-simpler-way-to-transpose.html
>    -
>
> http://adomas.eu/transposing-html-table-even-with-colspan-and-rowspan-used-with-jquery-javascript-code/
>
>
> **
> Martin
>