<script src="./data/scripts/cba.js"></script>
<script src="./data/scripts/justajax-table.js"></script>
<script>
window.onload = function(){
var _table = new justAjaxTable( {
'main' : document.getElementById('table-area'),
'dbtable' : 'authors',
'names' : ['#','Name','Author'],
'url' : 'http://192.168.1.34/joomla/index.php'} );
};
</script>
Ajax Table Grid Parameters Info: main - the reference to a template of the table, dbtable - name of the table in database, lengths - array of lengths of columns in percentage, columns caption, url - url of the backend
The correct structure of the document is considered as the necessary condition: required tags <body></body>.
It is only required to specify parameters of the connection to a DB in the backen:
// params
$_db = array (
'host' => 'localhost',
'user' => 'root',
'password' => '',
'database' => 'ajax'
);
and tables accessible to viewing and editing:
// possible tables
$poss_tables = array(
'authors' => array(
//parameters for 'authors'
'hidden_columns' => array('authors_genre'),
'editable' => true,
'disrows' => array('authors_id'),
'filter' => true,
'adding' => true,
'deleting' => true
),
'rss_db' => array()
);
The description of Ajax Table Grid parameters:
'authors','rss_db' - table's names;
'hidden_columns' - array with hidden fields;
'editable' - opportunity to edit the table.
( true - editing is possible, false - editing is forbidden).
Default value: false;
'disrows' - array of the fields forbidden for editing;
'filter' - enable/disable use of the filter.
Default value: true;
'adding' - enable/disable addition of new records.
Default value: false;
'deleting' - enable/disable deletion of records.
Default value: false;
Requirements to the table of databases.
Example of the table.
CREATE TABLE `authors` (
`authors_id` int(5) NOT NULL AUTO_INCREMENT,
`authors_product` varchar(255) NOT NULL DEFAULT 'default',
`authors_author` varchar(50) NOT NULL,
`authors_genre` varchar(50) NOT NULL,
KEY `authors_id` (`authors_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;