Items in table columns

5 views
Skip to first unread message

Richard Fantini

unread,
Jul 31, 2014, 12:39:35 AM7/31/14
to Pure-Unobtrusive...@googlegroups.com
I'm trying to find a simple directive to render item information into table columns, as opposed to rows. For example, with the following data:

var data = { 
"Items" : [ 
'Name' : 'Item1', 
'Size' : '10', 
'Price' : '49.99', 
},
'Name' : 'Item2', 
'Size' : '14', 
'Price' : '69.99', 
}
}

I'd like to render:

Item1      Item2
1014
49.9969.99


I'm sure I'm just overlooking something obvious.

Thanks!

-Rich

Mic (BeeBole)

unread,
Jul 31, 2014, 4:06:02 AM7/31/14
to Pure-Unobtrusive...@googlegroups.com
Hi Ritch,

The structure of a table (TD inside TR) does not allow a direct transformation.

You could do a TR/TD for each line.
Then a loop on each of them.
This is not very efficient, as you loop for each row, for every columns. But if you have a manageable number of colums.

If you don't know the number of lines.
You need to generate de directives dynamically.

And finally, you could use nested UL/LI instead of a table. And with CSS give them a table look.

Cheers,
-Mic

Reply all
Reply to author
Forward
0 new messages