Editor Methods |
The Editor type exposes the following members.
Name | Description | |
---|---|---|
Action(IEnumerableKeyValuePairString, String) |
Get the form action. For use with WebAPI's 'FormDataCollection' collection
| |
Action(NameValueCollection) |
Get the form action. For use with MVC's 'Request.Form' collection
| |
Action(HttpRequest) |
Get the form action. For use with an HttpRequest object
| |
Action(DtRequest) |
Get the form action.
| |
Data |
Get the response object that has been created by this instance. This
is only useful after process() | |
Db |
Get the database instance used by this instance
| |
Db(Database) |
Set the database connection instance
| |
Debug |
Get the debug state
| |
Debug(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.
| |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Field |
Get the fields that have been configured for this instance
| |
Field(String) |
Get a field instance that has already been added
| |
Field(Field) |
Add a new field to this instance
| |
Field(IEnumerableField) |
Add multiple fields too this instance
| |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
IdPrefix |
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.
| |
IdPrefix(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.
| |
InData |
Get the data that is being processed by the Editor instance. This is only
useful once the Process() | |
LeftJoin |
Add a left join condition to the Editor instance, allowing it to operate
over multiple tables. Multiple leftJoin() first_name users users.first_name | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
MJoin |
Add a 1-to-many ("mjoin") join to the Editor instance. The way the
join operates is defined by the MJoin class
| |
ModelT |
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 | |
On |
Add an event listener. The `Editor` class will trigger an number of
events that some action can be taken on.
| |
Pkey |
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'.
| |
Pkey(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'.
| |
Pkey(String) |
Set the column names for a compound primary key.
| |
PkeyToArray |
Convert a primary key combined value to an array of field values.
| |
PkeyToValue |
Convert a primary key array of field values to a combined value.
| |
Process(IEnumerableKeyValuePairString, String) |
Process a request from the Editor client-side to get / set data.
For use with WebAPI's 'FormDataCollection' collection
| |
Process(NameValueCollection) |
Process a request from the Editor client-side to get / set data.
For use with MVC's 'Request.Form' collection
| |
Process(HttpRequest) |
Process a request from the Editor client-side to get / set data.
For use with an HttpRequest object
| |
Process(DtRequest) |
Process a request from the Editor client-side to get / set data.
| |
Table |
Get the database table name this Editor instance will use
| |
Table(IEnumerableString) |
Add multiple tables to the Editor instance
| |
Table(String) |
Set the database table name this Editor instance will use
| |
ToString | Returns a string that represents the current object. (Inherited from Object.) | |
Transaction |
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.
| |
Transaction(Boolean) |
Set the transaction state for this instance.
| |
TryCatch |
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.
| |
Validate |
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 | |
Validator |
Get the global validator
| |
Validator(FuncEditor, DtRequestRequestTypes, DtRequest, String) |
Set a global validator
| |
Where(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).
| |
Where(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).
|