Othe public methods that can be used within this class can be seen
jqGrid Class Methods:
and here in
jqGrid Edit Class MethodsaddCol( $aproperties, [mixed $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 - default is first. If a number is set the column is added before the position corresponded to the position in colModel
API Tags:
Access: public
callGridMethod( string $grid, string $method, [ $aoptions = null] )
JavaScript 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:
Access: public
getColModel( )
Return array of the generated colModel. Should be called after setColModel
API Tags:
Access: public
getGridOption( string $key )
Return a jqGrid option specified by the key, false if the option can not be found.
Parameters:
string $key: the name of the grid option
API Tags:
Access: public
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
- 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:
Access: public
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
setButtonOptions( string $exptype , array $aoptions )
Set a various options for the buttons on the navigator bar like tite, caption , icon.
For the other CRUD buttons see parameters passed to the 'navigator'
Parameters:
- string $exptype: The button which is placed in the pager. The name correspond of those of the navigator - can be excel, csv, pdf, columns.
- array $aoptions: array containing the following keys - "caption", "title", "buttonicon"
API Tags:
Access: public
setColModel( [ $model = null], [ $params = null], [ $labels = null] )
Construct the column model of the grid. The model can be passed as array or constructed from the SQL Query . The method try to determine the primary key and if it is found 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: parametters passed to the SQL query
- array $labels: if this parameter is set the method set the labels in colModel. The array should be associative which key value correspond to the name of colModel
API Tags:
Access: public
setColProperty( mixed $colname, $aproperties )
Set a new property in the constructed colModel. Return true on success. Should be called after setColModel method.
Parameters:
- mixed $colname: valid coulmn name or index in colModel
- array $aproperties: the key name properties.
API Tags:
Access: public
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
setFilterOptions( array $aoptions )
Set options for the toolbar filter when enabled with $toolbarfilter
Parameters:
- array $aoptions: valid options for the filterToolbar
API Tags:
Access: public
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:
Access: public
setGridOptions( array $aoptions )
Set a grid options. The method uses array with keys correspondingto the jqGrid options as described in jqGrid docs
Parameters:
- array $aoptions: A key name pair. Some options can be array to.
API Tags:
Access: public
setJSCode( string $code )
Put a javascript 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:
Access: public
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, search
- string $event: - valid event for the particular module
- string $code: - javascript code to be executed when the event occur
API Tags:
Access: public
setNavOptions( string $module, array $aoptions )
Set options in the navigator or in diffrent diffrent modules add,edit,del,view, search
Parameters:
- string $module: - can be navigator, add, edit, del, view, search
- array $aoptions: options that are applicable to this module The key correspond to the options in jqGrid
API Tags:
Access: public
setSelect( string $colname, mixed $data, [boolean $formatter = true], [boolean $editing = true], [boolean $seraching = true], [array $defvals = array()], string $sep = ":", string $delim=";" )
Construct the html select used in the grid. The select element can be used in the editing modules, in formatter or in search module. The purpose of this method is to link other tables to desired filed.
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 arrary(""=>"All"); Note that this is puted only in the serch modules, but not in the editing one
- string $sep: set the separator between the key and text in the javascropt colModel when a select is build. Deafult is ":"
- string $delim: set the delemiter between the options elemets in the javascropt colModel when a select is build. Deafult is ";"
API Tags:
Access: public
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 subnames options are set
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:
Access: public
setSubGridGrid( string $suggridurl, array $subgridnames=null )
Prepares a subgrid in the grid expecting any valid html content provieded via the $suggridurl
Parameters:
- string $suggridurl: url from where to get html content
- array $subgridnames: array containing a valid names from the generated colModel. In this case a pair name value (name provided in the array and the value from the corresponding clicked row) is added to the url and posted to the server.
API Tags:
Access: public
setUrl( string $newurl )
Set a url for editing and the grid url from where to obtain the data.
Parameters:
- string $newurl: the new url
API Tags:
Access: public