Click or drag to resize
Editor Methods

The Editor type exposes the following members.

Methods
  NameDescription
Public methodStatic memberAction(IEnumerableKeyValuePairString, String)
Get the form action. For use with WebAPI's 'FormDataCollection' collection
Public methodStatic memberAction(NameValueCollection)
Get the form action. For use with MVC's 'Request.Form' collection
Public methodStatic memberAction(HttpRequest)
Get the form action. For use with an HttpRequest object
Public methodStatic memberAction(DtRequest)
Get the form action.
Public methodData
Get the response object that has been created by this instance. This is only useful after
process()
has been called.
Public methodDb
Get the database instance used by this instance
Public methodDb(Database)
Set the database connection instance
Public methodDebug
Get the debug state
Public methodDebug(Boolean)
Set the debug state. If enabled (`true`) Editor will record information about the SQL queries it makes and return that information in the JSON sent to the client-side query once the request has been processed.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodField
Get the fields that have been configured for this instance
Public methodField(String)
Get a field instance that has already been added
Public methodField(Field)
Add a new field to this instance
Public methodField(IEnumerableField)
Add multiple fields too this instance
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodIdPrefix
Get the DOM prefix. Typically primary keys are numeric and this is not a valid ID value in an HTML document - is also increases the likelihood of an ID clash if multiple tables are used on a single page. As such, a prefix is assigned to the primary key value for each row, and this is used as the DOM ID, so Editor can track individual rows.
Public methodIdPrefix(String)
Set the DOM prefix. Typically primary keys are numeric and this is not a valid ID value in an HTML document - is also increases the likelihood of an ID clash if multiple tables are used on a single page. As such, a prefix is assigned to the primary key value for each row, and this is used as the DOM ID, so Editor can track individual rows.
Public methodInData
Get the data that is being processed by the Editor instance. This is only useful once the
Process()
method has been called, and is available for use in validation and formatter methods.
Public methodLeftJoin
Add a left join condition to the Editor instance, allowing it to operate over multiple tables. Multiple
leftJoin()
calls can be made for a single Editor instance to join multiple tables. A left join is the most common type of join that is used with Editor so this method is provided to make its use very easy to configure. Its parameters are basically the same as writing an SQL left join statement, but in this case Editor will handle the create, update and remove requirements of the join for you: * Create - On create Editor will insert the data into the primary table and then into the joined tables - selecting the required data for each table. * Edit - On edit Editor will update the main table, and then either update the existing rows in the joined table that match the join and edit conditions, or insert a new row into the joined table if required. * Remove - On delete Editor will remove the main row and then loop over each of the joined tables and remove the joined data matching the join link from the main table. Please note that when using join tables, Editor requires that you fully qualify each field with the field's table name. SQL can result table names for ambiguous field names, but for Editor to provide its full CRUD options, the table name must also be given. For example the field
first_name
in the table
users
would be given as
users.first_name
.
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodMJoin
Add a 1-to-many ("mjoin") join to the Editor instance. The way the join operates is defined by the MJoin class
Public methodModelT
Set a model to use. In keeping with the MVC style of coding, you can define the fields and their types that you wish to get from the database in a simple class. Editor will automatically add fields from the model. Note that fields that are defined in the model can also be defined as
Field
instances should you wish to add additional options to a specific field such as formatters or validation.
Public methodOn
Add an event listener. The `Editor` class will trigger an number of events that some action can be taken on.
Public methodPkey
Get the primary key field that has been configured. The primary key must be known to Editor so it will know which rows are being edited / deleted upon those actions. The default value is 'id'.
Public methodPkey(String)
Set the primary key field to use. Please note that at this time Editor does not support composite primary keys in a table, only a single field primary key is supported. The primary key must be known to Editor so it will know which rows are being edited / deleted upon those actions. The default value is 'id'.
Public methodPkey(String)
Set the column names for a compound primary key.
Public methodPkeyToArray
Convert a primary key combined value to an array of field values.
Public methodPkeyToValue
Convert a primary key array of field values to a combined value.
Public methodProcess(IEnumerableKeyValuePairString, String)
Process a request from the Editor client-side to get / set data. For use with WebAPI's 'FormDataCollection' collection
Public methodProcess(NameValueCollection)
Process a request from the Editor client-side to get / set data. For use with MVC's 'Request.Form' collection
Public methodProcess(HttpRequest)
Process a request from the Editor client-side to get / set data. For use with an HttpRequest object
Public methodProcess(DtRequest)
Process a request from the Editor client-side to get / set data.
Public methodTable
Get the database table name this Editor instance will use
Public methodTable(IEnumerableString)
Add multiple tables to the Editor instance
Public methodTable(String)
Set the database table name this Editor instance will use
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodTransaction
Get the transaction state for this instance. When enabled (which it is by default) Editor will use an SQL transaction to ensure data integrity while it is performing operations on the table. This can be optionally disabled using this method, if required by your database configuration.
Public methodTransaction(Boolean)
Set the transaction state for this instance.
Public methodTryCatch
Enable (default) / disable the error catching that Editor performs when processing the data from the client. When enabled any errors will be presented in a format that can be presented to the end user, but it makes debugging much more difficult if an error should occur inside the DataTables dll. Disabling the try / catch makes it much easier to see exactly where the error is occuring.
Public methodValidate
Perform validation on a data set. Note that validation is performed on data only when the action is 'create' or 'edit'. Additionally, validation is performed on the _wire data_ - i.e. that which is submitted from the client, without formatting. Any formatting required by
setFormatter
is performed after the data from the client has been validated.
Public methodValidator
Get the global validator
Public methodValidator(FuncEditor, DtRequestRequestTypes, DtRequest, String)
Set a global validator
Public methodWhere(ActionQuery)
Where condition to add to the query used to get data from the database. Multiple conditions can be added if required. Can be used in two different ways: * Simple case: `where( field, value, operator )` * Complex: `where( fn )` The simple case is fairly self explanatory, a condition is applied to the data that looks like `field operator value` (e.g. `name = 'Allan'`). The complex case allows full control over the query conditions by providing a closure function that has access to the database Query that Editor is using, so you can use the `where()`, `or_where()`, `and_where()` and `where_group()` methods as you require. Please be very careful when using this method! If an edit made by a user using Editor removes the row from the where condition, the result is undefined (since Editor expects the row to still be available, but the condition removes it from the result set).
Public methodWhere(String, Object, String)
Where condition to add to the query used to get data from the database. Multiple conditions can be added if required. Can be used in two different ways: * Simple case: `where( field, value, operator )` * Complex: `where( fn )` The simple case is fairly self explanatory, a condition is applied to the data that looks like `field operator value` (e.g. `name = 'Allan'`). The complex case allows full control over the query conditions by providing a closure function that has access to the database Query that Editor is using, so you can use the `where()`, `or_where()`, `and_where()` and `where_group()` methods as you require. Please be very careful when using this method! If an edit made by a user using Editor removes the row from the where condition, the result is undefined (since Editor expects the row to still be available, but the condition removes it from the result set).
Top
See Also