All pastes #188015 Raw Edit

Mine

public text v1 · immutable
·published 2006-10-01 18:08 UTC
rendered paste body
var data = eval( '(' + '<?php echo $json -> encode( $collection ); ?>' + ')' );

$.Grid = {
	
	settings:{
		sortable: false,
		header: false
	},
	
	draw: function( test ){
		console.log( this.data );
		if( this.settings['header'] == true )
		{
			tmpRow = $.TR( {} );
			for( cellkey in this.data[ 0 ] )
			{	tmpRow.appendChild( $.TH( {}, cellkey ));	}
			
			this.grid.appendChild( tmpRow );
			
		}
		
		
		//	FOR EACH ROW
		var i = 0;
		for( key in this.data )
		{	var tmpRow = $.TR( {} );
		
			if ( i % 2 == 1 )
			{ 	var tmpRow = $.TR( { class:'odd', data:this.data[ key ] } );	}
			else
			{	var tmpRow = $.TR( { data:this.data[ key ] } );	}
		
			console.log( this.data[ key ] );
			//	FOR EACH CELL
			for( cellkey in this.data[ key ] )
			{	
				var tmpCell = $.TD( {}, this.data[ key ][ cellkey ] );
				tmpRow.appendChild( tmpCell );
				
				
			}
			
			this.grid.appendChild( tmpRow );
			
			i++;
		}
		
	},
	
	grid: $.TABLE( { class:'dataGrid' } )
	
	
}