Field Class |
Namespace: DataTables
public class Field
The Field type exposes the following members.
Name | Description | |
---|---|---|
Field(String) |
Create a new Field instance - common db name and http name
| |
Field(String, String) |
Create a new Field instance - different db and http names
| |
Field(String, Type, String) |
Create a new Field instance - common db name and http name with type specified
| |
Field(String, String, Type, String) |
Create a new Field instance - different db and http names with type specified
|
Name | Description | |
---|---|---|
DbField |
Set the DB field name.
| |
DbField(String) |
Set the DB field name.
Note that when used as a setter, an alias can be given for the field
using the SQL `as` keyword - for example: `firstName as name`. In this
situation the dbField is set to the field name before the `as`, and the
field's name (`name()`) is set to the name after the ` as `.
As a result of this, the following constructs have identical
functionality:
* `.field.DbField( 'firstName as name' );`
* `.field.DbField( 'firstName', 'name' );`
| |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
Get |
Get the 'Get' flag for the field.
| |
Get(Boolean) |
Set the 'Get' flag of the field.
A field can be marked as write only by setting the Get property to false
| |
GetFormatter |
Get formatter for the field's data.
When the data has been retrieved from the server, it can be passed through
a formatter here, which will manipulate (format) the data as required. This
can be useful when, for example, working with dates and a particular format
is required on the client-side.
Editor has a number of formatters available with the Format | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
GetValue |
Get the 'Get' value for the field
| |
GetValue(FuncObject) |
Set a "Get" delegate. When set, the delegate given here is executed
when the data for the field is requested and the value returned is
send to the client-side, regardless of what value is held by the
database (if this field even has a database value!)
| |
GetValue(Object) |
Set a "Get" value. When set this value is used to send to the
client-side, regardless of what value is held by the database.
(if this field even has a database value!)
| |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
Name |
Get the HTTP / JSON name for the field.
The name is typically the same as the `DbField` name, since it makes things
less confusing(!), but it is possible to set a different name for the data
which is used in the JSON returned to DataTables in a 'get' operation and
the field name used in a 'set' operation.
| |
Name(String) |
Set the HTTP / JSON name for the field.
The name is typically the same as the `DbField` name, since it makes things
less confusing(!), but it is possible to set a different name for the data
which is used in the JSON returned to DataTables in a 'get' operation and
the field name used in a 'set' operation.
| |
Options |
Get the Options object configured for this field
| |
Options(FuncListDictionaryString, Object) |
Set a function that will retrieve a list of values that can be used
for the options list in radio, select and checkbox inputs from the
database for this field.
| |
Options(Options) |
Set the options for this field using an Options instance
| |
Options(String, String, IEnumerableString, ActionQuery, FuncDictionaryString, Object, String) |
Provide database information for where to get a list of values that
can be used for the options list in radio, select and checkbox
inputs from the database for this field.
Note that this is for simple cases only. For more complex operations
use the delegate overload.
| |
Options(String, String, String, ActionQuery, FuncDictionaryString, Object, String) |
Provide database information for where to get a list of values that
can be used for the options list in radio, select and checkbox
inputs from the database for this field.
Note that this is for simple cases only. For more complex operations
use the delegate overload.
| |
Set |
Get the "Set" flag for this field
| |
Set(Boolean) |
Set the "Set" flag for this field.
A field can be marked as read only using this option, to be set only
during an create or edit action or to be set during both actions. This
provides the ability to have fields that are only set when a new row is
created (for example a "created" time stamp).
For more control, use the `SetType` overload.
| |
Set(FieldSetType) |
Set the "Set" flag for this field.
A field can be marked to be set on create, edit, both or none using
this method, providing the ability, for example, to write to
`created` and `updated` datetime columns as appropriate.
| |
SetFormatter |
Set formatter for the field's data.
When the data has been retrieved from the server, it can be passed through
a formatter here, which will manipulate (format) the data as required. This
can be useful when, for example, working with dates and a particular format
is required on the client-side.
Editor has a number of formatters available with the Format | |
SetValue |
Retrieve the "Set" value for the field
| |
SetValue(FuncObject) |
Set a "Set" delegate. When set, the delegate given here is executed
when the data for the field is to be written to the database and the
value returned is used, regardless of what is sent by the client-side
(if the parameter was even sent!).
| |
SetValue(Object) |
Set a "Set" value. When set this value is used to write to the
database regardless of what data is sent from the client-side
(if the parameter was even sent!).
| |
ToString | Returns a string that represents the current object. (Inherited from Object.) | |
Type |
Get the field type
| |
Type(Type) |
Set the data type for the field's values
| |
TypeError |
Get the type error message
| |
TypeError(String) |
If the value retrieved from the database can't be cast to the type
given, this is the error message that will be given.
| |
Upload |
Get the Upload instance for this field
| |
Upload(Upload) |
Set the upload instance for this field
| |
Validator |
Set the 'validator' of the field.
The validator can be used to check if any abstract piece of data is valid
or not according to the given rules of the validation function used.
Multiple validation options can be applied to a field instance by calling
this method multiple times. For example, it would be possible to have a
'Required' validation and a 'MaxLength' validation with multiple calls.
Editor has a number of validation available with the Validation | |
Xss(Boolean) |
Option to quickly disable XSS formatting.
| |
Xss(FuncString, String) |
Set a formatting method that will be used for XSS checking / removal.
This should be a function that takes a single argument (the value to be
cleaned) and returns the cleaned value.
Editor will use the Microsfot security librarie's `Encoder.HtmlEncode`
method by default for this operation, which is built into the software
and no additional configuration is required, but a custom function can
be used if you wish to use a different formatter such as HtmlSanitizer.
If you wish to disable this option (which you would only do if you are
absolutely confident that your validation will pick up on any XSS inputs)
simply pass in 'false' or provide a closure function that returns the
value given to the function. This is _not_ recommended.
|