higrid.net


hiGrid\hgGridEdit
hgGrid.php at line 1917

Class hgGridEdit

jqGrid
└─hgGridEdit
All Known Subclasses:
hgGridRender

public abstract class hgGridEdit
extends jqGrid

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

Field Summary
boolean

$add

Enables/disables adding of record into the table

booolen

$decodeinput

Decodes the input for update and insert opeartions using the html_entity_decode

boolean

$del

Enables/disables deleting of record into the table

boolean

$edit

Enables/disables updating of record into the table

bolean

$getLastInsert

Allow a obtaining and sending the last id (in case of serial key) to the client.

string

$mtype

Determines the type of accepting the input data.

boolean

$serialKey

Defines if the primary key is serial (autoincrement)

boolean

$trans

If true every CRUD is enclosed within begin transaction - commit/rollback

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
void

setSuccessMsg(string msg)

Set the message which will be send to client side grid when succefull CRUD operation is performed.

string

getPrimaryKeyId()

Return the primary key of the table

void

setPrimaryKeyId(string keyid)

Set a primary key for the table

void

setTable(string _newtable)

Set table for CRUD and build the fields

void

setBeforeCrudAction(string oper, string sql, array params)

Run a sql command(s) before the operation from the CRUD.

void

setAfterCrudAction(string oper, string sql, array params)

Run a sql command(s) after the operation from the CRUD is succefull.

array

getFields()

Return the fields generated for CRUD operations

boolean

insert(array data)

Insert the data array into the database according to the table element.

boolean

update(array data)

Update the data into the database according the table element A primaryKey should be set.

mixed

getLastInsertId()

Return the last inserted id from the insert method in cas getLastInsert is set to true

boolean

delete(array data, str where, mixed params)

Delete the data into the database according the table element A primaryKey should be set.

protected boolean

checkPrimary()

Check for primary key and if not set try to obtain it Return true on success

void

editGrid(array summary, array params, string oper, bool echo)

Perform the all CRUD operations depending on the oper param send from the grid and the table element If the primaryKey is not set we try to obtain it using hiGridDB::getPrimaryKey If the primary key is not set or can not be obtained the operation is aborted.

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 1974

add

public boolean $add = true

Enables/disables adding of record into the table


hgGrid.php at line 1994

decodeinput

public booolen $decodeinput = false

Decodes the input for update and insert opeartions using the html_entity_decode


hgGrid.php at line 1984

del

public boolean $del = true

Enables/disables deleting of record into the table


hgGrid.php at line 1979

edit

public boolean $edit = true

Enables/disables updating of record into the table


hgGrid.php at line 1951

getLastInsert

public bolean $getLastInsert = false

Allow a obtaining and sending the last id (in case of serial key) to the client.


hgGrid.php at line 1989

mtype

public string $mtype = "POST"

Determines the type of accepting the input data. Can be POST or GET


hgGrid.php at line 1945

serialKey

public boolean $serialKey = true

Defines if the primary key is serial (autoincrement)


hgGrid.php at line 1969

trans

public boolean $trans = true

If true every CRUD is enclosed within begin transaction - commit/rollback


Method Detail

hgGrid.php at line 1935

setSuccessMsg

public void setSuccessMsg(string msg)

Set the message which will be send to client side grid when succefull CRUD operation is performed. Usually afterSubmit event should be used in this case.


hgGrid.php at line 1999

getPrimaryKeyId

public string getPrimaryKeyId()

Return the primary key of the table


hgGrid.php at line 2007

setPrimaryKeyId

public void setPrimaryKeyId(string keyid)

Set a primary key for the table


hgGrid.php at line 2016

setTable

public void setTable(string _newtable)

Set table for CRUD and build the fields


hgGrid.php at line 2170

setBeforeCrudAction

public void setBeforeCrudAction(string oper, string sql, array params)

Run a sql command(s) before the operation from the CRUD. Can run a unlimited

Parameters:
oper - - the operation after which the command should be run
sql - - the sql command
params - - parameters passed to the sql query.

hgGrid.php at line 2194

setAfterCrudAction

public void setAfterCrudAction(string oper, string sql, array params)

Run a sql command(s) after the operation from the CRUD is succefull. Can run a unlimited

Parameters:
oper - - the operation after which the command should be run
sql - - the sql command
params - - parameters passed to the sql query.

hgGrid.php at line 2214

getFields

public array getFields()

Return the fields generated for CRUD operations


hgGrid.php at line 2229

insert

public boolean insert(array data)

Insert the data array into the database according to the table element. A primaryKey should be set. If the key is not set It can be obtained from hiGridDB::getPrimaryKey Return true on succes, false otherwiese.

Todo:
in the future we should return the last insert id from the table
Parameters:
data - associative array which key values correspond to the names in the table.

hgGrid.php at line 2373

update

public boolean update(array data)

Update the data into the database according the table element A primaryKey should be set. If the key is not set It can be obtained from hiGridDB::getPrimaryKey Return true on success, false when the operation is not succefull

Todo:
possibility to set additional where clause
Parameters:
data - associative array which key values correspond to the names in the table

hgGrid.php at line 2506

getLastInsertId

public mixed getLastInsertId()

Return the last inserted id from the insert method in cas getLastInsert is set to true


hgGrid.php at line 2522

delete

public boolean delete(array data, str where, mixed params)

Delete the data into the database according the table element A primaryKey should be set. If the key is not set It can be obtained from hiGridDB::getPrimaryKey Return true on success, false when the operation is not succefull

Todo:
possibility to set additional where clause
Parameters:
data - associative array which key values correspond to the names in the delete command

hgGrid.php at line 2635

checkPrimary

protected boolean checkPrimary()

Check for primary key and if not set try to obtain it Return true on success


hgGrid.php at line 2667

editGrid

public void editGrid(array summary, array params, string oper, bool echo)

Perform the all CRUD operations depending on the oper param send from the grid and the table element If the primaryKey is not set we try to obtain it using hiGridDB::getPrimaryKey If the primary key is not set or can not be obtained the operation is aborted. Also the method call the queryGrid to perform the grid ouput

Parameters:
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
params - additional parameters that can be passed to the query
oper - if set the requested oper operation is performed without to check the parameter sended from the grid.

higrid.net