Click or drag to resize
Field Class
Field definitions for the DataTables Editor. Each Database column that is used with Editor can be described with this Field method (both for Editor and Join instances). It basically tells Editor what table column to use, how to format the data and if you want to read and/or write this column.
Inheritance Hierarchy
SystemObject
  DataTablesField

Namespace:  DataTables
Assembly:  DataTables (in DataTables.dll) Version: 1.6.5.0 (1.6.5.0)
Syntax
C#
public class Field

The Field type exposes the following members.

Constructors
  NameDescription
Public methodField(String)
Create a new Field instance - common db name and http name
Public methodField(String, String)
Create a new Field instance - different db and http names
Public methodField(String, Type, String)
Create a new Field instance - common db name and http name with type specified
Public methodField(String, String, Type, String)
Create a new Field instance - different db and http names with type specified
Top
Methods
  NameDescription
Public methodDbField
Set the DB field name.
Public methodDbField(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' );`
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
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 methodGet
Get the 'Get' flag for the field.
Public methodGet(Boolean)
Set the 'Get' flag of the field. A field can be marked as write only by setting the Get property to false
Public methodGetFormatter
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
class which can be used directly with this method.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodGetValue
Get the 'Get' value for the field
Public methodGetValue(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!)
Public methodGetValue(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!)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodName
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.
Public methodName(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.
Public methodOptions
Get the Options object configured for this field
Public methodOptions(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.
Public methodOptions(Options)
Set the options for this field using an Options instance
Public methodOptions(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.
Public methodOptions(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.
Public methodSet
Get the "Set" flag for this field
Public methodSet(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.
Public methodSet(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.
Public methodSetFormatter
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
class which can be used directly with this method.
Public methodSetValue
Retrieve the "Set" value for the field
Public methodSetValue(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!).
Public methodSetValue(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!).
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodType
Get the field type
Public methodType(Type)
Set the data type for the field's values
Public methodTypeError
Get the type error message
Public methodTypeError(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.
Public methodUpload
Get the Upload instance for this field
Public methodUpload(Upload)
Set the upload instance for this field
Public methodValidator
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
class which can be used directly with this method.
Public methodXss(Boolean)
Option to quickly disable XSS formatting.
Public methodXss(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.
Top
See Also