Jasmine Wiki |
|
|
Navigation Wiki HomeInstalling Framework Configuring jasmine.php Database Module MySQL Mysqlix ODBC MSSQL Database Objects Datagrid Datasource Repeater SQLQuery Files Module File FileSystem FTP Attachment ExcelFile Graphics Module Color Image Graph Miscellaneous Classes: NumbWordter Poll Shield XMLParser Functions: General Functions HTML Functions Validation Functions TrackThisPage
|
Datagrid In Jasmine, datagrid refers to the HTML table that will be displayed from the datatable provided by the database. The datagrid also has a functionality to link column text to the custom specified URL.Using Datagrid Datagrid can be instantiated from the class -- Datagrid. After that, source formed in JasmineDataSource format can be assigned to it and finally rendered to display the html. Let $db be the database connection handler. Suppose $sql is the query, when executed will return a data table. And this database table has to be displayed as normal html table using Datagrid. So, Before executing the query, $createSource in database handler should be turned on. e.g. $db->createSource=true; $db->query($sql); After executing the query, the rows will be stacked in $source property of $db and is accessible via $db->source; $dg=new Datagrid; $dg->source=$db->source; $dg->render(); Adding links to column content - Colmapping Sometimes, content of one column needs to be linked to some other page. For example, user ID in forum users table need to be linked to the user details page. In such scenarios, $colMapping property of Datagrid might come handy. To specify the column, you need to provide the column name in the special string format. i.e. e.g. $dg->source=$db->source; $dg->colMapping['User_Name']='user_details.php?user= $dg->render(); Adding custom styles Apart from the default style given by the datagrid, the look can be changed by assigning proper style elements to the datagrid before rendering. e.g. $dg->source = $db->source; $dg->width = '98%'; >>or '753px' $dg->border = '0px'; $dg->padding = '3px'; >>cell padding $db->spacing = '0px'; >>cell spacing $dg->borderColor = '#B1B9AA'; $dg->style = 'font-size:10px'; >>to be given as in style tag. $dg->headerStyle = 'background-color:#5B97B1; color:#FFFFFF; align:left;'; $dg->render(); |
(c) 2008 Jasmine Framework. A Creation by Krishna Srikanth. |
|