I think i am getting a tad closer i am trying to find out how i can make 
multi rows with a
for loop then insert them in to the table or just put them in a var in 
the deleration of the table
it self. I have been looking at this callender.js and i am a tad confused :(

var days = [];
for (var i=0; i<this.data['days'].length; i++)
days[i] = { 'node' : "th", 'class' : this.classes['day-name'], 'content' : 
this.data['days'][i] };
return [ 'tr', {}, [ $.tpl( days, this.tpl['cell'] ) ] ];

This code look sto be what i need just de coding it is a tad hard hehe. 
I am assuming that $.tpl will do what i want? It takes a json array then 
produces multi rows from it?


There is also this method
http://mg.to/2006/02/27/easy-dom-creation-for-jquery-and-prototype#comment-176

I am assuming it is the same author? and the example there shows that it 
has the ability to create rows?
var json = [
   {'name' : "John", 'surname' : "Smith"},
   {'name' : "Sarra", 'surname' : "Smith"}
];

$.tpl(json, function(){
   return [
      'tr', { 'class':"MyTableRow" }, [
         'td', { 'class':"MyTableCol1" }, [ this.name ],
         'td', { 'class':"MyTableCol2" }, [ this.surname ]]
   ];
}).appendTo($('#fill-table > tbody').get(0));

Dave Methvin wrote:
>> How would i go about making a table and then inserting rows
>> in the body in a for loop. I am wanting to create a stats board for 
>> a post match. I figured i would create the table and then append
>> to it am i right in how to go about this? How would i append to a
>> tag in the table i just created?
>> http://3spn.net/jQuery/dom_creation.html
>> I wanted to add more player rows how would i do that? hehe I
>> tried to do a append($table > tr) deal but it didnt work.
>>     
>
> The tr elements descend from either thead or tbody, so table>tr won't match
> anything. There's a workaround in the latest jQuery that will  catch the
> case of appending tr to table and put it in tbody, but it's best to say it
> yourself.
>
> Instead of applying a style to each td, use a colgroup and apply the styles
> (or classes) to the col elements. It will save you a lot of messy coding.
>
>
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
>
>   


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to