higrid.net


hiGrid\hgGridRender
hgGrid.php at line 2717

Class hgGridRender

jqGrid
└─hgGridEdit
└─hgGridRender
All Known Subclasses:
hgTreeGrid\hgTreeGrid

public abstract class hgGridRender
extends hgGridEdit

Author:
She Yi [email protected]
Copyright:
HiGrid.net
Version:
2.1

Field Summary
string

$csvfile

The export to file to CSV

string

$csvsep

SCV separator

string

$csvsepreplace

CSV string to replavce separator

boolean

$export

Enable/disable the export to excel

string

$exportfile

The export to file to excel

type boolean If set to true add the inline navigator buttons for inline editing

$inlineNav

boolean

$navigator

Enable/disable navigator in the grid.

string

$pdffile

The export to file to PDF

boolean

$sharedAddOptions

If set to true put the form add options as grid option so they can be used from other places

boolean

$sharedDelOptions

If set to true put the form delete options as grid option so they can be used from other places

boolean

$sharedEditOptions

If set to true put the form edit options as grid option so they can be used from other places

boolean

$toolbarfilter

Enable/disable tollbar search.

Fields inherited from hiGrid\hgGridEdit
add, decodeinput, del, edit, getLastInsert, mtype, serialKey, trans
Fields inherited from hiGrid\jqGrid
ExportCommand, SubgridCommand, cacheCount, customClass, customError, customFunc, dataType, datearray, debug, encoding, errorMessage, gSQLMaxRows, higridSC, jsonencode, logtofile, mongofields, mongointegers, oper, optimizeSearch, performcount, readFromXML, showError, table, version, xmlCDATA
Method Summary
array

getColModel()

Return the generated colModel

mixed

getGridOption(string key)

Return a jqGrid option specified by the key, false if the option can not be found.

void

higridsGO(array aoptions)

Set a grid option.

boolean

setUrl(string newurl)

Set a editing url.

boolean

setSubGrid(string suburl, array subnames, array subwidth, array subalign, array subparams)

Prepares a executuion of a simple subgrid Return false if no name options for the subgrid.

boolean

setSubGridGrid(string subgridurl, array subgridnames)

Prepares a subgrid in the grid expecting any valid html content provieded via the $suggridurl

boolean

setSelect(string colname, mixed data, boolean formatter, boolean editing, boolean seraching, array defvals)

Construct the select used in the grid.

void

setAutocomplete(string colname, string target, mixed data, array options, boolean editing, boolean seraching, bool searching)

Construct autocompleter used in the grid.

void

setDatepicker(string colname, array options, boolean editing, boolean seraching, bool searching)

Construct a pop up calender used in the grid.

bolean

setGridEvent(string event, string code)

Set a valid grid event

boolean

higridsNO(string module, array aoptions)

Set options in the navigator for the diffrent actions

boolean

setNavEvent(string module, string event, string code)

Set a event in the navigator or in the diffrent modules add,edit,del,view, search

boolean

inlineNavOptions(string module, array aoptions)

Set a options for inline editing in particulear module

boolean

inlineNavEvent(string module, string event, string code)

Set a event for inline editing in particulear module

type

getInlineOptions()

Return a array of the all events and options for the inline navigator

void

setFilterOptions(array aoptions)

Set options for the tolbar filter when enabled

void

callGridMethod(string grid, string method, array aoptions)

Construct a code for execution of valid grid method.

void

setJSCode(string code)

Put a javascript arbitrary code after all things are created.

boolean

setColModel(array model, array params, array labels)

Construct the column model of the grid.

boolean

higridsCP(mixed colname, array aproperties)

Set a new property in the constructed colModel Return true on success.

boolean

addCol(array aproperties, string position)

Add a column at the first or last position in the colModel and sets a certain properties to it

void

setButtonOptions(string exptype, array aoptions)

Set a various options for the buttons on the pager.

mixed.

higridOP(string tblelement, string pager, boolean script, array summary, array params, boolean createtbl, boolean createpg, boolean echo)

Main method which do allmost everthing for the grid.

Methods inherited from hiGrid\hgGridEdit
checkPrimary, delete, editGrid, getFields, getLastInsertId, getPrimaryKeyId, insert, setAfterCrudAction, setBeforeCrudAction, setPrimaryKeyId, setSuccessMsg, setTable, update
Methods inherited from hiGrid\jqGrid
__construct, addUserData, buildSearch, debugout, execute, exportToCsv, exportToExcel, exportToPdf, getDbDate, getDbTime, getGridParams, getSqlElement, getStringForGroup, getUserDate, getUserTime, logQuery, parseSql, queryForObject, queryGrid, querySubGrid, rs2excel, rs2pdf, selectLimit, sendErrorHeader, setDbDate, setDbTime, setGridParams, setPdfOptions, setUserDate, setUserTime

Field Detail

hgGrid.php at line 2759

csvfile

public string $csvfile = 'higrid_export.csv'

The export to file to CSV


hgGrid.php at line 2764

csvsep

public string $csvsep = ';'

SCV separator


hgGrid.php at line 2769

csvsepreplace

public string $csvsepreplace = ";"

CSV string to replavce separator


hgGrid.php at line 2744

export

public boolean $export = true

Enable/disable the export to excel


hgGrid.php at line 2749

exportfile

public string $exportfile = 'higrid_export.xml'

The export to file to excel


hgGrid.php at line 2739

inlineNav

public type boolean If set to true add the inline navigator buttons for inline editing $inlineNav = false


hgGrid.php at line 2728
public boolean $navigator = false

Enable/disable navigator in the grid. Default false


hgGrid.php at line 2754

pdffile

public string $pdffile = 'higrid_export.pdf'

The export to file to PDF


hgGrid.php at line 2779

sharedAddOptions

public boolean $sharedAddOptions = false

If set to true put the form add options as grid option so they can be used from other places


hgGrid.php at line 2784

sharedDelOptions

public boolean $sharedDelOptions = false

If set to true put the form delete options as grid option so they can be used from other places


hgGrid.php at line 2774

sharedEditOptions

public boolean $sharedEditOptions = false

If set to true put the form edit options as grid option so they can be used from other places


hgGrid.php at line 2733

toolbarfilter

public boolean $toolbarfilter = false

Enable/disable tollbar search. Default false


Method Detail

hgGrid.php at line 2859

getColModel

public array getColModel()

Return the generated colModel


hgGrid.php at line 2870

getGridOption

public mixed getGridOption(string key)

Return a jqGrid option specified by the key, false if the option can not be found.

Parameters:
key - the named grid option

hgGrid.php at line 2882

higridsGO

public void higridsGO(array aoptions)

Set a grid option. The method uses array with keys corresponding to the jqGrid options as described in jqGrid docs

Parameters:
aoptions - A key name pair. Some options can be array to.

hgGrid.php at line 2898

setUrl

public 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:
newurl - the new url

hgGrid.php at line 2921

setSubGrid

public boolean setSubGrid(string suburl, array subnames, array subwidth, array subalign, array subparams)

Prepares a executuion of a simple subgrid Return false if no name options for the subgrid.

Parameters:
suburl - Url from where to get the data
subnames - Required - the names that should correspond to fields of the data
subwidth - (optional) - sets a width of the subgrid columns. Default 100
subalign - (optional) - set the aligmend of the columns. default center
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

hgGrid.php at line 2945

setSubGridGrid

public boolean setSubGridGrid(string subgridurl, array subgridnames)

Prepares a subgrid in the grid expecting any valid html content provieded via the $suggridurl

Parameters:
subgridurl - url from where to get html content
subgridnames - a array with names from colModel which values will be posted to the server

hgGrid.php at line 2997

setSelect

public boolean setSelect(string colname, mixed data, boolean formatter, boolean editing, boolean seraching, array defvals)

Construct the select used in the grid. The select element can be used in the editing modules, in formatter or in search module

Parameters:
colname - (requiered) valid colname in colmodel
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
formatter - deternines that the select should be used in the formatter of type select. Default is true
editing - determines if the select should be used in editing modules. Deafult is true
seraching - determines if the select should be present in the search module. Deafult is true.
defvals - Set the default value if none is selected. Typically this is usefull in serch modules. Can be something like arrar(""=>"All");

hgGrid.php at line 3088

setAutocomplete

public void setAutocomplete(string colname, string target, mixed data, array options, boolean editing, boolean seraching, bool searching)

Construct autocompleter used in the grid. The autocomplete can be used in the editing modules or/and in search module.

Uses:
jqAutocomplete class. This requiere to include jqAutocomplete.php in order to work
Parameters:
colname - (requiered) valid colname in colModel
target - if set determines the input element on which the value will be set after the selection in the autocompleter
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.
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.
editing - determines if the autocomplete should be used in editing modules. Deafult is true
seraching - determines if the autocomplete should be present in the search module. Deafult is true.

hgGrid.php at line 3182

setDatepicker

public void setDatepicker(string colname, array options, boolean editing, boolean seraching, bool searching)

Construct a pop up calender used in the grid. The datepicker can be used in the editing modules or/and in search module.

Uses:
jqCalender class. This requiere to include jqCalender.php in order to work
Parameters:
colname - (requiered) valid colname in colModel
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.
editing - determines if the datepicker should be used in editing modules. Deafult is true
seraching - determines if the datepicker should be present in the search module. Deafult is true.

hgGrid.php at line 3230

setGridEvent

public bolean setGridEvent(string event, string code)

Set a valid grid event

Parameters:
event - - valid grid event
code - Javascript code which will be executed when the event raises

hgGrid.php at line 3245

higridsNO

public boolean higridsNO(string module, array aoptions)

Set options in the navigator for the diffrent actions

Parameters:
module - - can be navigator, add, edit, del, view
aoptions - options that are applicable to this module The key correspond to the options in jqGrid

hgGrid.php at line 3287

setNavEvent

public 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:
module - - can be navigator, add, edit, del, view
event - - valid event for the particular module
code - - javascript code to be executed when the event occur

hgGrid.php at line 3326

inlineNavOptions

public boolean inlineNavOptions(string module, array aoptions)

Set a options for inline editing in particulear module

Parameters:
module - - can be navigator or add or edit
aoptions - array of options

hgGrid.php at line 3356

inlineNavEvent

public boolean inlineNavEvent(string module, string event, string code)

Set a event for inline editing in particulear module

Parameters:
module - - can be add or edit
event - the name of the event
code - the javascript code for this event

hgGrid.php at line 3373

getInlineOptions

public type getInlineOptions()

Return a array of the all events and options for the inline navigator


hgGrid.php at line 3382

setFilterOptions

public void setFilterOptions(array aoptions)

Set options for the tolbar filter when enabled

Parameters:
aoptions - valid options for the filterToolbat

hgGrid.php at line 3397

callGridMethod

public void callGridMethod(string grid, string method, array aoptions)

Construct a code for execution of valid grid method. This code is putted after the creation of the grid

Parameters:
grid - valid grid id should be putted as #mygrid
method - valid grid method
aoptions - contain the parameters passed to the method. Omit this parameter if the method does not have parameters

hgGrid.php at line 3416

setJSCode

public 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:
code - - javascript to be executed

hgGrid.php at line 3438

setColModel

public boolean setColModel(array model, array params, array labels)

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.

See Also:
_setSQL
Parameters:
model - if set construct the model ignoring the SQL command
params - if a sql command is used parametters passed to the SQL
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

hgGrid.php at line 3504

higridsCP

public boolean higridsCP(mixed colname, array aproperties)

Set a new property in the constructed colModel Return true on success.

Parameters:
colname - valid coulmn name or index in colModel
aproperties - the key name properties.

hgGrid.php at line 3538

addCol

public boolean addCol(array aproperties, string position)

Add a column at the first or last position in the colModel and sets a certain properties to it

Parameters:
aproperties - data representing the column properties - including name, label...
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

hgGrid.php at line 3571

setButtonOptions

public void setButtonOptions(string exptype, array aoptions)

Set a various options for the buttons on the pager. tite, caption , icon


hgGrid.php at line 3612

higridOP

public mixed. higridOP(string tblelement, string pager, boolean script, array summary, array params, boolean createtbl, boolean createpg, boolean echo)

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:
tblelement - the id of the table element to costrict the grid
pager - the id for the pager element
script - if set to true add a script tag before constructin the grid.
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
params - parameters passed to the query
createtbl - if set to true the table element is created automatically from this method. Default is false
createpg - if set to true the pager element is created automatically from this script. Default false.
echo - if set to false the function return the string representing the grid

higrid.net