Home | Contact | About Me

 

MyTableGrid is a JavaScript based DataGrid control built on the Prototype library. It allows you to display your data in a simple and flexible way.

Documentation

Here you can see the definition of the methods provided by the MyTableGrid object and their components.

MyTableGrid

Method Description
getCurrentPosition() Returns the focus current position

example:
								tableGrid.getCurrentPosition(); //returns [0,0]
							
getColumnIndex(id) Returns the index position for a given column id

parameters:

id: Column identificator

example:
								tableGrid.getColumnIndex('title'); //returns 1
							
getRow(index) Returns the row located at the index position

example:
								tableGrid.getRow(0);
							
return
			{id: '1', title: 'Empire Burlesque', artist: 'Bob Dylan', country: 'EU', company: 'Columbia', price: '10.90', year: '1985'}
							
getModifiedRows() Returns an array containing the modified rows

example:
								tableGrid.getModifiedRows();
							
for example return
            [{id: '1', title: 'Empire Burlesque', artist: 'Bob Dylan', country: 'EU', company: 'Columbia', price: '10.90', year: '1985'}]
							
if you modify the first row.
getValueAt(x,y) Returns the value at position x, y

parameters:

x: x coordinate
y: y coordinate

example:
								tableGrid.getValueAt(1,2); //returns 'One night only'
							
setValueAt(value, x,y) Set a value at position x, y

parameters:

x: x coordinate
y: y coordinate

example:
								tableGrid.setValueAt('Hello MyTableGrid',1,2); 
							
clear() Reset the status (useful after performing a save operation)

example:
								tableGrid.clear(); 
							
refresh() Reload the datagrid data

example:
								tableGrid.refresh(); 
							
addNewRow() Add an empty new row to the datagrid

example:
								tableGrid.addNewRow(); 
							
deleteRows() Delete selected rows (first you need to define a checkbox selectable column)

example:
								tableGrid.deleteRows(); 
							
getDeletedRows() Returns an array with the rows already deleted

example:
								tableGrid.getSeletedRows(); 
							
returns
            [{id: '1', title: 'Empire Burlesque', artist: 'Bob Dylan', country: 'EU', company: 'Columbia', price: '10.90', year: '1985'}]
							
if you delete the first row.
getNewRowsAdded() Returns an array with the rows already added

example:
								tableGrid.getSeletedRows(); 
							
returns
            [{id: '1', title: 'Stars', artist: 'Simply Red', country: 'EU', company: 'Columbia', price: '10.90', year: '1990'}]
							
if you add this row.