/*	PAX Datagrid demo
	
	The below javascript will create a data grid, that loads sample data vis JSON.
*/
pax.load.onloaded( function() {
	pax.widget.datagrid.init( pax.$('widget.datagrid.init.example1'), {
		url: '../examples/pax.widget.example.table.php',		//	Where to get the data from (JSON)
		param: {												//	Paramaters for server requests
			limit: 10,											//	Number of rows to display / fetch at any one time
			sort: 'name',										//	Default sort column
			offset: 0											//	Default offset
		},
		ignoreCols: [ 'notes' ],								//	Columns to ignore (hide)
		colWidth: { id: '30', name: '160', country: '200' },	//	The width of specific columns
		colName: { country: 'Person location' },				//	Custom name for column
		itemClick: function( val ) {							//	Function to fire, when an item is clicked
			alert( 'Item click' +
				'\n	row: ' + val['row'] +
				'\n	col: ' + val['col'] +
				'\n	data: ' + pax.util.toString( val['data'] ) + 
				'\n	target: ' + val['target'].id + 
				'\n	event: ' + val['event'] +
				'\n\nYou could allow editing of the value, or link to a different page here.' + 
				'\nAlso see the rowClick method, for row click handeling.'
			);
		}
	} );
} );
