If you want to propagate your own GET or POST parameters, pass the data to the script, so it continue transferring the parameters in the dataGrid, for this, use:
Function name:
linkparam("parameters");
Parameters:
parameters
:
You must set the parameter list in the same way that parameters of the type GET
Example of use:
Atention:
The variables to be included in the list of parameters must have been previously caught, for instance, to capture the variable session:
If method = GET: $session = $_GET['session'];
If method = POST: $session = $_POST['session'];
If you do not know the request method or it can be mixed (GET and/or POST): $session = (isset($_GET['session'])?$_GET['session']:(isset($_POST['session'])?$_POST['session']:''));
Note that the list of parameters are delimited by double quotes and the name of the variables enclosed between brackets {}, so, the variables are replaced by its record value.
true = Will use ADOdb library for connection false = Will use MySQL native drivers on php
strType
:
For connetions made with ADOdb, you can define the database Type to use
intPort
:
DataBase port
Example of use:
Atention: If you choose to use ADOdb library to make the connection, you must download it from ADOdb website, and must include the necesary files at the beginning of the script
The default language for messages phpMyDataGrid is English, if you want to change the language, use this function:
Function name:
language('strLang');
Parameters:
strLang
:
Enter the two-character ISO code language
Example of use:
Atention: Available languages on phpMyDataGrid Professional are Spanish and English, if you want to add another language, you can just create the file in the languages folder.
If you want to set the number of pages that appear before summarize with ... change the amount with this function:
Function name:
linksperpage('amount');
Parameters:
amount
:
Enter the number of links that you want to display
Example of use:
Atention: Do not define very large quantities because they can distort the structure of the Grid
By setting linksperpage = 5, you'll look something like this:
1 2 3 4 5 ... 15 16 17 18 19 20 21 22 23 24 25 ... 45 46 47 48 49
Define the type of paging, there are 3 available values:
links = Generates a list page numbers indicating the page number to which the user want to go (Recommended tables with no more than 20 pages) select = Generates a menu that lets you choose the number of page you want to go mixed = Generates a list combining the above methods (default)
inTable
:
true = Page numbers will be formated inside a table false = Standar page style
Edit button = Function must have 2 parameters, delimited in the following way: (\"%s\",\"%s\"); Sample: $objGrid -> setAction('edit','new_editrow(\"%s\",\"%s\")');
Delete Button = Function must have 2 parameters, delimited in the following way: (\"%s\",\"%s\"); Sample: $objGrid -> setAction('delete','new_deleterow(\"%s\",\"%s\")');
View Button = Function must have 2 parameters, delimited in the following way: (\"%s\",\"%s\"); Sample: $objGrid -> setAction('view','new_viewrow(\"%s\",\"%s\")');
If you need to group records by some fields, or fields, you can use this function:
Function name:
groupby('strGroup');
Parameters:
strGroup
:
Example of use:
Atention: Note that when grouping data, the functionality of maintenance (Add, Edit, Delete, online edition), not function properly, therefore it is recommended to disable, or if necessary, implement your own maintenance processes.
The professional version has a feature which will allow you to order manually a set of records, which is useful for example to define the order in which products will appear on a page:
Function name:
setorderarrows('field');
Parameters:
field
:
The consecutive field should not be the table ID
Example of use:
Atention: The ordering field should be consecutive and not be autoincrementable, for the examples that we have developed, its value is always the same as the autoincrementable ID value
By default, phpMyDataGrid enables the ordering arrows in the titles of all the columns, if you want to disable this feature use the following function:
Function name:
noorderarrows();
Example of use:
Atention: If you want to disable the ordering of a few columns only, DO NOT use this function, instead use chField specifying the necessary parameters.
phpMyDataGrid automatically generates SQL queries based on the information provided, but sometimes it is necessary to generate advanced queries that require the programmer defined them manually, to do this, use:
Function name:
sqlstatement('strSQL','strCount');
Parameters:
strSQL
:
strCount
:
Example of use:
Atention: User defined SQL queries should not include sentences WHERE, GROUP or ORDER, these must be defined directly from the class functions. You should have in mind that it is very important that all the names of fields used in the grid must be defined in the SQL query
For the developer it is essential to track the performance of the scripts, this feature allows to the programmer to receive emails with 'any' SQL errors that may be generated:
Function name:
reportSQLErrorsTo('strMail', 'bolShow');
Parameters:
strMail
:
Developer e-mail
bolShow
:
true = Display SQL errors on the screen to end user (Recommended while developing)) false = Hides any generated SQL errors (Recommended for production environments)
Example of use:
Atention: This function uses the mail() php function, therefore to work properly, it must be configured and working
Used only in textarea fields, it is used to set the textarea rows
maxlength
:
Max length allowed to be typed by user
inputtype
:
Field type
0 = Normal Field
1 = Read only field
2 = Hidden field
3 = Image, calc, link or imagelink without relation to a field
4 = Image, calc or link related with a field
columnwidth
:
Column width (in pixels)
align
:
Column Text align
center = (default)
left
right
Mask
:
Masking to field
text = Normal field text
textarea = Region for text editing (may have a larger area that the fields type text)
image = Display an image, may be field related or static. (view samples)
imagelink = Display a clickable image, may be field related or static. (view samples)
number = Numeric field
money = Numeric money sign field, format: money:sign, sample money:$money:£
date = Date type field, format: date:format:separator, sample date:dmy:/date:ymd:-
link = Link field. view samples
password = Password type field
calc = Calculated field. view samples
scalc = Calculated field which stores the result in a field, view samples
bool = Boolean field, create a checkbox and store 0 when unchecked and 1 when checked
check = same as bool type field
select = Field with a dropdown menu, the options can be manually defined or dynamically loaded from another table in the database.
0 = Integer, no decimals
1 = Float 1 decimal
2 = Float 2 decimals
3 = Float 3 decimals
4 = float 4 decimals
integer = Integer, no decimals
default
:
Default value for field (Used in add option)
cutChar
:
Used generally in textarea fields which are too long, by using this parameter the grid will only display the amount of X characters
You can define aditional atributes for each column:
Function name:
chField('strfieldName', 'permissions')
Parameters:
strfieldName
:
Field Name
permissions
:
N+ = Display field while adding
N- = Hide field while adding
E+ = Display field while editing
E- = Hide field while editing
V+ = Display field while viewing records
V- = Hide field while viewing
R = Remove order arrows for field
U = (only for imagetype fields) allow new images to be uploaded to the field
M = (only for imagetype fields) Allow images to be uploaded, no matter if field already has an image on it
Example of use:
Atention: You would combine several atributes in the same request, sample: $objGrid -> chField('firstname','N-E+V+R');
JavaScript code to validate, (You can call a JS function as well)
strErrorMessage
:
Error Message
strDisplayMessage
:
Input instructions message
Example of use:
Atention: Javascript validations will be executed on New and Edit options, as well in online edition, please keep in mind you can validate only the actual field (this.) validations can not be done combined with other fields