Class: jqGridRender
Source Location: /jqGrid.php
Class jqGridRender
Class Overview
Located in /jqGrid.php [line 1592]
jqGrid
|
--jqGridEdit
|
--jqGridRender
Author(s):
- Tony Tomov, (tony@trirand.com)
API Tags:
Abstract: | This is a top level class which do almost evething with the grid without to write Java Script code. |
Information Tags:
Version: | 3.8.0.1 |
Copyright: | TriRand Ltd |
|
Properties
|
Methods
|
Inherited Properties, Constants, and Methods
Property Summary
array |
$colModel |
Holds the colModel for the grid. Can be passed as param or created |
string |
$customCode |
Custom java script code which is set after creation of the grid |
boolean |
$export |
Enable/disable the export to excel |
boolean |
$navigator |
Enable/disable navigator in the grid. Default false |
boolen |
$runSetCommands |
When set to false some set comands are not executed for spped improvements Usual this is done after setColModel. |
Method Summary
boolean |
addCol() |
Add a column at the first or last position in the colModel and sets a certain |
void |
callGridMethod() |
Construct a code for execution of valid grid method. This code is putted |
mixed |
getGridOption() |
Return a jqGrid option specified by the key, false if the option can not be found. |
mixed. |
renderGrid() |
Main method which do allmost everthing for the grid |
void |
setAutocomplete() |
Construct autocompleter used in the grid. The autocomplete can be used in the editing modules or/and in search module. |
boolean |
setColModel() |
Construct the column model of the grid. The model can be passed as array |
boolean |
setColProperty() |
Set a new property in the constructed colModel Return true on success. |
void |
setDatepicker() |
Construct a pop up calender used in the grid. The datepicker can be used in the editing modules or/and in search module. |
void |
setGridOptions() |
Set a grid option. The method uses array with keys corresponding |
void |
setJSCode() |
Put a javascript arbitrary code after all things are created. The method is executed only once when the grid is created. |
boolean |
setNavEvent() |
Set a event in the navigator or in the diffrent modules add,edit,del,view, search |
boolean |
setNavOptions() |
Set options in the navigator for the diffrent actions |
boolean |
setSelect() |
Construct the select used in the grid. The select element can be used in the |
boolean |
setSubGrid() |
Prepares a executuion of a simple subgrid Return false if no name options for the subgrid. |
boolean |
setSubGridGrid() |
Prepares a subgrid in the grid expecting any valid html content provieded |
boolean |
setUrl() |
Set a editing url. Note that this set a url from where to obtain and/or edit data. |
Properties
Default add form dialog options
API Tags:
Holds the colModel for the grid. Can be passed as param or created
automatically API Tags:
Custom java script code which is set after creation of the grid
API Tags:
Default delete form dialog options
API Tags:
Default editing form dialog options
API Tags:
Enable/disable the export to excel
API Tags:
The export to file to excel
API Tags:
Default fileter toolbar search options
API Tags:
Holds the grid methods.
API Tags:
Default grid parameters
API Tags:
Enable/disable navigator in the grid. Default false
API Tags:
Default navigaror options
API Tags:
When set to false some set comands are not executed for spped improvements Usual this is done after setColModel.
API Tags:
Default search options
API Tags:
Enable/disable tollbar search. Default false
API Tags:
Default view form dialog options
API Tags:
Methods
boolean addCol(
$aproperties, [string
$position = 'last']
)
|
|
Add a column at the first or last position in the colModel and sets a certain
properties to it
Parameters:
array |
$aproperties: |
data representing the column properties - including name, label... |
string |
$position: |
can be first or last or number - default is first. If a number is set the column is added before the position corresponded to the position in colmodel |
API Tags:
void callGridMethod(
string
$grid, string
$method, [
$aoptions = null]
)
|
|
Construct a code for execution of valid grid method. This code is putted
after the creation of the grid
Parameters:
string |
$grid: |
valid grid id should be putted as #mygrid |
string |
$method: |
valid grid method |
array |
$aoptions: |
contain the parameters passed to the method. Omit this parameter if the method does not have parameters |
API Tags:
Return the generated colModel
API Tags:
mixed getGridOption(
string
$key
)
|
|
Return a jqGrid option specified by the key, false if the option can not be found.
Parameters:
string |
$key: |
the named grid option |
API Tags:
mixed. renderGrid(
[string
$tblelement = ''], [string
$pager = ''], [boolean
$script = true], [
$summary = null], [
$params = null], [boolean
$createtbl = false], [boolean
$createpg = false], [boolean
$echo = true]
)
|
|
Main method which do allmost everthing for the grid
Construct the grid, perform CRUD operations, perform Query and serch operations, export to excel, set a jqGrid method, and javascript code
Parameters:
string |
$tblelement: |
the id of the table element to costrict the grid |
string |
$pager: |
the id for the pager element |
boolean |
$script: |
if set to true add a script tag before constructin the grid. |
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 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: |
parameters passed to the query |
boolean |
$createtbl: |
if set to true the table element is created automatically from this method. Default is false |
boolean |
$createpg: |
if set to true the pager element is created automatically from this script. Default false. |
boolean |
$echo: |
if set to false the function return the string representing the grid |
API Tags:
void setAutocomplete(
string
$colname, [string
$target = false], [mixed
$data = ''], [array
$options = null], [boolean
$editing = true], [
$searching = false], boolean
$seraching
)
|
|
Construct autocompleter used in the grid. The autocomplete can be used in the editing modules or/and in search module.
Parameters:
string |
$colname: |
(requiered) valid colname in colModel |
string |
$target: |
if set determines the input element on which the value will be set after the selection in the autocompleter |
mixed |
$data: |
can be array or string which is the SQL command which is executed to obtain the values. The command can contain one, two or three fields. If the field in SQL command is one, then this this field will be displayed and setted as value in the element. If the fields in SQL command are two, then the second field will be displayed but the first will be setted as value in the element. |
array |
$options: |
- array with options for the autocomplete. Can be all available options from jQuery UI autocomplete in pair name=>value. In case of events a "js:" tag should be added before the value. Additionally to this the following options can be used - cache, searchType, ajaxtype, itemLiength. For more info refer to docs. |
boolean |
$editing: |
determines if the autocomplete should be used in editing modules. Deafult is true |
boolean |
$seraching: |
determines if the autocomplete should be present in the search module. Deafult is true. |
|
$searching: |
|
API Tags:
Access: | public |
Uses: | jqAutocomplete - class. This requiere to include jqAutocomplete.php in order
to work |
boolean setColModel(
[
$model = null], [
$params = null], [
$labels = null]
)
|
|
Construct the column model of the grid. The model can be passed as array
or can be constructed from sql. See _setSQL() to determine which SQL is used. The method try to determine the primary key and if it is found is set as key:true to the appropriate field. If the primary key can not be determined set the first field as key:true in the colModel. Return true on success.
Parameters:
array |
$model: |
if set construct the model ignoring the SQL command |
array |
$params: |
if a sql command is used parametters passed to the SQL |
array |
$labels: |
if this parameter is set it set the labels in colModel. The array should be associative which key value correspond to the name of colModel |
API Tags:
boolean setColProperty(
mixed
$colname,
$aproperties
)
|
|
Set a new property in the constructed colModel Return true on success.
Parameters:
mixed |
$colname: |
valid coulmn name or index in colModel |
array |
$aproperties: |
the key name properties. |
API Tags:
void setDatepicker(
string
$colname, [array
$options = null], [boolean
$editing = true], [
$searching = true], boolean
$seraching
)
|
|
Construct a pop up calender used in the grid. The datepicker can be used in the editing modules or/and in search module.
Parameters:
string |
$colname: |
(requiered) valid colname in colModel |
array |
$options: |
- array with options for the datepicker. Can be all available options from jQuery UI datepicker in pair name=>value. In case of events a "js:" tag should be added before the value. |
boolean |
$editing: |
determines if the datepicker should be used in editing modules. Deafult is true |
boolean |
$seraching: |
determines if the datepicker should be present in the search module. Deafult is true. |
|
$searching: |
|
API Tags:
Access: | public |
Uses: | jqCalender - class. This requiere to include jqCalender.php in order
to work |
void setFilterOptions(
array
$aoptions
)
|
|
Set options for the tolbar filter when enabled
Parameters:
array |
$aoptions: |
valid options for the filterToolbat |
API Tags:
bolean setGridEvent(
string
$event, string
$code
)
|
|
Set a valid grid event
Parameters:
string |
$event: |
- valid grid event |
string |
$code: |
Javascript code which will be executed when the event raises |
API Tags:
void setGridOptions(
array
$aoptions
)
|
|
Set a grid option. The method uses array with keys corresponding
to the jqGrid options as described in jqGrid docs
Parameters:
array |
$aoptions: |
A key name pair. Some options can be array to. |
API Tags:
void setJSCode(
string
$code
)
|
|
Put a javascript arbitrary code after all things are created. The method is executed only once when the grid is created.
Parameters:
string |
$code: |
- javascript to be executed |
API Tags:
boolean setNavEvent(
string
$module, string
$event, string
$code
)
|
|
Set a event in the navigator or in the diffrent modules add,edit,del,view, search
Parameters:
string |
$module: |
- can be navigator, add, edit, del, view |
string |
$event: |
- valid event for the particular module |
string |
$code: |
- javascript code to be executed when the event occur |
API Tags:
boolean setNavOptions(
string
$module, array
$aoptions
)
|
|
Set options in the navigator for the diffrent actions
Parameters:
string |
$module: |
- can be navigator, add, edit, del, view |
array |
$aoptions: |
options that are applicable to this module The key correspond to the options in jqGrid |
API Tags:
boolean setSelect(
string
$colname, mixed
$data, [boolean
$formatter = true], [boolean
$editing = true], [boolean
$seraching = true], [array
$defvals = array()]
)
|
|
Construct the select used in the grid. The select element can be used in the
editing modules, in formatter or in search module
Parameters:
string |
$colname: |
(requiered) valid colname in colmodel |
mixed |
$data: |
can be array (with pair key value) or string which is the SQL command which is executed to obtain the values. The command should contain a minimun two fields. The first is the key and the second is the value whch will be displayed in the select |
boolean |
$formatter: |
deternines that the select should be used in the formatter of type select. Default is true |
boolean |
$editing: |
determines if the select should be used in editing modules. Deafult is true |
boolean |
$seraching: |
determines if the select should be present in the search module. Deafult is true. |
array |
$defvals: |
Set the default value if none is selected. Typically this is usefull in serch modules. Can be something like arrar(""=>"All"); |
API Tags:
boolean setSubGrid(
[string
$suburl = ''], [array
$subnames = false], [array
$subwidth = false], [array
$subalign = false], [array
$subparams = false]
)
|
|
Prepares a executuion of a simple subgrid Return false if no name options for the subgrid.
Parameters:
string |
$suburl: |
Url from where to get the data |
array |
$subnames: |
Required - the names that should correspond to fields of the data |
array |
$subwidth: |
(optional) - sets a width of the subgrid columns. Default 100 |
array |
$subalign: |
(optional) - set the aligmend of the columns. default center |
array |
$subparams: |
(optional) additional parameters that can be passed when the subgrid plus icon is clicked. The names should be present in colModel in order to pass the values |
API Tags:
boolean setSubGridGrid(
string
$subgridurl, [array
$subgridnames = null]
)
|
|
Prepares a subgrid in the grid expecting any valid html content provieded
via the $suggridurl
Parameters:
string |
$subgridurl: |
url from where to get html content |
array |
$subgridnames: |
a array with names from colModel which values will be posted to the server |
API Tags:
boolean setUrl(
string
$newurl
)
|
|
Set a editing url. Note that this set a url from where to obtain and/or edit data.
Return false if runSetCommands is already runned (false)
Parameters:
string |
$newurl: |
the new url |
API Tags:
|
|