addUserData( array $adata )
Add a custom data to the grid footer row if it is enabled. Also can be used to transport additional data in userdata array to be used later at client side. The syntax is $grid->addUserData(array("Name1"=>"Data1",...)); The method is executed after the sumarry rows are executed, so it can overwrite some summary data which is palced on the footer.
Parameters:
- array $adata: associative array
buildSearch( $filter, $otype='str' )
Build a where clause friom filter string compatible with string posted from grid when a search is performed.
Usually this method is used separatley.
Parameters:
- string $filter: the string to be parsed
- string $otype: determines the return value. if it is = str the return is a string, otherviese array with values redy to be used in prepared statement
- return string or array depending on $otype parameter
void debugout( )
Prints all executed SQL queries to file or console
API Tags:
See: jqGrid::$logtofile
Access: public
exportToCsv( [ $summary = null], [ $params = null], [ $colmodel = null], [$echo = true], [$filename = 'exportdata.csv'], [$sep=';'], [$sepreplace=''] )
Public method to export a grid data to csv data.
Can use the ExportCommand. If this command is not set uses _setSQL to set the query.
The number of rows exported is limited from gSQLMaxRows variable
@see _setSQL API.
Parameters:
- array $summary: - set which columns should be sumarized in order to be displayed to the grid By default this parameter uses SQL SUM function: array("colmodelname"=>"sqlname"); It can be set to use the other one this way array("colmodelname"=>array("sqlname"=>"AVG")); By default the first field correspond to the name of colModel the second to the database name
- array $params: parameter values passed to the SQL if the query is with parameters
- array $colmodel: - diffrent descriptions for the headars, width, hidden cols This array is actually a colModel array in jqGrid. The array can look like Array( [0]=>Array("label"=>"Some label", "width"=>100, "hidden"=>true, "name"=>"client_id", "formatter"=>"select", editoptions=>...), [1]=>Array("label"=>"Other label", "width"=>80, "hidden"=>false, "name"=>"date",... ), ... )
- boolean $echo: determines if the result should be returned or echoed
- string $filename: the filename to which the sheet can be saved in case if $echo is true
- string $sep - the separator for the csv data
- string $sepreplace - with what to replace the separator if in data
- return string
exportToExcel( [ $summary = null], [ $params = null], [ $colmodel = null], [$echo = true], [$filename = 'exportdata.xls'] )
Export the recordset to excel xml file. Can use the ExportCommand. If this command is not set uses _setSQL to set the query. The number of rows exported is limited from gSQLMaxRows variable
Parameters:
- array $summary: - set which columns should be sumarized in order to be displayed to the grid By default this parameter uses SQL SUM function: array("colmodelname"=>"sqlname"); It can be set to use the other one this way array("colmodelname"=>array("sqlname"=>"AVG")); By default the first field correspond to the name of colModel the second to the database name
- array $params: parameter values passed to the SQL if the query is with parameters
- array $colmodel: - diffrent descriptions for the headars, width, hidden cols This array is actually a colModel array in jqGrid. The array can look like Array( [0]=>Array("label"=>"Some label", "width"=>100, "hidden"=>true, "name"=>"client_id", "formatter"=>"select", editoptions=>...), [1]=>Array("label"=>"Other label", "width"=>80, "hidden"=>false, "name"=>"date",... ), ... )
- boolean $echo: determines if the result should be returned or echoed
- string $filename: the filename to which the sheet can be saved in case if $echo is true
exportToPdf( [ $summary = null], [ $params = null], [ $colmodel = null], [$filename = 'exportdata.pdf'] )
Export the recordset to PDF file. Can use the ExportCommand. If this command is not set uses _setSQL to set the query. The number of rows exported is limited from gSQLMaxRows variable.
The method uses the setPdfOptions to set various PDF options. See below.
Parameters:
- array $summary: - set which columns should be sumarized in order to be displayed to the grid By default this parameter uses SQL SUM function: array("colmodelname"=>"sqlname"); It can be set to use the other one this way array("colmodelname"=>array("sqlname"=>"AVG")); By default the first field correspond to the name of colModel the second to the database name
- array $params: parameter values passed to the SQL if the query is with parameters
- array $colmodel: - diffrent descriptions for the headars, width, hidden cols This array is actually a colModel array in jqGrid. The array can look like Array( [0]=>Array("label"=>"Some label", "width"=>100, "hidden"=>true, "name"=>"client_id", "formatter"=>"select", editoptions=>...), [1]=>Array("label"=>"Other label", "width"=>80, "hidden"=>false, "name"=>"date",... ), ... )
- string $filename: the filename to which the export can be saved
getDbDate( )
Return the current date format used in the undelayed database. The default format is 'Y-m-d'
API Tags:
Access: public
getDbTime( )
Return the current datetime format used in the undelayed database. The default format is 'Y-m-d H:i:s'
API Tags:
Access: public
getGridParams( )
Return the associative array which contain the parameters that are sended from the grid to request, search, update delete data. These parameters correspond to the prmNames objec in jqGrid Java Script library
API Tags:
Access: public
getUserDate( )
Return the current date format used from the client. The default format is 'd/m/Y'
API Tags:
Access: public
getUserTime( )
Return the current date format used from the client. The default format is 'd/m/Y H:i:s'
API Tags:
Access: public
queryGrid( [ $summary = null], [ $params = null], [boolen $echo = true] )
Return the result of the query to jqGrid. Support searching,paging, sorting. Also support summarized rows. Note that this method output the result in name:value pair. With other words the repeatitems parameter in json or xml reader in jqGrid should be set to false.
Parameters:
- array $summary: - set which columns should be sumarized in order to be displayed to the grid By default this parameter uses SQL SUM function: array("colmodelname"=>"sqlname"); It can be set to use the other one this way array("colmodelname"=>array("sqlname"=>"AVG")); By default the first field correspond to the name of colModel the second to the database name
- array $params: - parameter values passed to the sql
- boolen $echo: if set to false return the records as object, otherwiese json encoded or xml string depending on the dataType variable
API Tags:
Access: public
querySubGrid( array $params )
Return the result of the query for the simple subgrid. The format (json or xml) depend of dataType variable
Parameters:
- array $params: parameters passed to the query
API Tags:
Access: public
selectLimit( [$limsql = ''], [$nrows = -1], [$offset = -1], [ $params = null] )
Will select, getting rows from $offset (1-based), for $nrows.This simulates the MySQL "select * from table limit $offset,$nrows" , and the PostgreSQL "select * from table limit $nrows offset $offset". Note that MySQL and PostgreSQL parameter ordering is the opposite of the other. eg. Also supports Microsoft SQL Server SelectLimit('select * from table',3); will return rows 1 to 3 (1-based) SelectLimit('select * from table',3,2); will return rows 3 to 5 (1-based) Return object containing the limited record set.
Parameters:
- string $limsql: optional sql clause, if not set uses SelctCommand or table.
- integer $nrows: is the number of rows to get
- integer $offset: is the row to start calculations from (1-based)
- array $params: array of bind variables
API Tags:
Access: public
setDbDate( string $newformat )
Set a new database date format using PHP convensions
Parameters:
- string $newformat: - the new database format
API Tags:
Access: public
setDbTime( string $newformat )
Set a new database datetime format using PHP convensions
Parameters:
- string $newformat: - the new database format
API Tags:
Access: public
setGridParams( array $_aparams )
Set a grid parameters to identify the action from the grid. Note that these should be set in the grid (prmNames) - i.e the parameters from the grid should equal to the GridParams.
Parameters:
- array $_aparams: set new parameter.
API Tags:
Access: public
setPdfOptions( array $apdf )
Set options for PDF export.
Parameters:
- array $_appdf: set new PDF parameters.
API Tags:
Access: public
The default PDF parammeters are stored in protected array and are listed below with the default values
array(
"page_orientation" => "P",
"unit"=>"mm",
"page_format"=>"A4",
"creator"=>"jqGrid",
"author"=>"jqGrid",
"title"=>"jqGrid PDF",
"subject"=>"Subject",
"keywords"=>"table, grid",
"margin_left"=>15,
"margin_top"=>7,
"margin_right"=>15,
"margin_bottom"=>25,
"margin_header"=>5,
"margin_footer"=>10,
"font_name_main"=>"helvetica",
"font_size_main"=>10,
"header_logo"=>"",
"header_logo_width"=>0,
"header_title"=>"",
"header_string"=>"",
"header"=>false,
"footer"=>true,
"font_monospaced"=>"courier",
"font_name_data"=>"helvetica",
"font_size_data"=>8,
"margin_footer"=>10,
"image_scale_ratio"=>1.25,
"grid_head_color"=>"#dfeffc",
"grid_head_text_color"=>"#2e6e9e",
"grid_draw_color"=>"#5c9ccc",
"grid_header_height"=>6,
"grid_row_color"=>"#ffffff",
"grid_row_text_color"=>"#000000",
"grid_row_height"=>5,
"grid_alternate_rows"=>false,
"path_to_pdf_class"=>"tcpdf/tcpdf.php"
"shrink_cell"=>true,
"reprint_grid_header"=>false,
"shrink_header"=>true,
"unicode" => true,
"encoding" => "UTF-8"
);
setSuccessMsg( string $msg )
Set a string which will be send to the grid if the operation after add, edit or del is successfull.
Parameters:
- string $msg: - message send to the grid
API Tags:
Access: public
setUserTime( string $newformat )
Set a new user datetime format using PHP convensions
Parameters:
- string $newformat: - the new format
API Tags:
Access: public