Show / Hide Table of Contents

Class Format

Formatter methods for the DataTables Editor. All of the methods in this class return a delegate that can be used in the

GetFormatter
and
SetFormatter
methods of the
Field
class.

Each method may define its own parameters that configure how the formatter operates. For example the date / time formatters take information on the formatting to be used.

Inheritance
System.Object
Format
Namespace: DataTables
Assembly: DataTables-Editor-Server.dll
Syntax
public static class Format : object

Fields

| Improve this Doc View Source

DATE_ISO_1036

Date format: Fri, 9 Mar 12. jQuery UI equivalent format: D, d M y

Declaration
public const string DATE_ISO_1036 = null
Field Value
Type Description
System.String
| Improve this Doc View Source

DATE_ISO_1123

Date format: Fri, 9 Mar 2012. jQuery UI equivalent format: D, d M yy

Declaration
public const string DATE_ISO_1123 = null
Field Value
Type Description
System.String
| Improve this Doc View Source

DATE_ISO_2822

Date format: Fri, 9 Mar 2012. jQuery UI equivalent format: D, d M yy

Declaration
public const string DATE_ISO_2822 = null
Field Value
Type Description
System.String
| Improve this Doc View Source

DATE_ISO_822

Date format: Fri, 9 Mar 12. jQuery UI equivalent format: D, d M y

Declaration
public const string DATE_ISO_822 = null
Field Value
Type Description
System.String
| Improve this Doc View Source

DATE_ISO_850

Date format: Friday, 09-Mar-12. jQuery UI equivalent format: DD, dd-M-y

Declaration
public const string DATE_ISO_850 = null
Field Value
Type Description
System.String
| Improve this Doc View Source

DATE_ISO_8601

Date format: 2012-03-09. jQuery UI equivalent format: yy-mm-dd

Declaration
public const string DATE_ISO_8601 = null
Field Value
Type Description
System.String
| Improve this Doc View Source

DATE_USA

Date format: 03-09-2012 (US style)

Declaration
public const string DATE_USA = null
Field Value
Type Description
System.String

Methods

| Improve this Doc View Source

DateFormatToSql(String)

Convert to SQL date / date time format (ISO8601) from a format given by the options parameter.

Declaration
public static Func<object, Dictionary<string, object>, object> DateFormatToSql(string format)
Parameters
Type Name Description
System.String format

Value to convert to SQL date format

Returns
Type Description
Func<System.Object, Dictionary<System.String, System.Object>, System.Object>

Formatter delegate

| Improve this Doc View Source

DateSqlToFormat(String)

Convert from SQL date / date time format (ISO8601) to a format given by the options parameter.

Declaration
public static Func<object, Dictionary<string, object>, object> DateSqlToFormat(string format)
Parameters
Type Name Description
System.String format

Value to convert from SQL date format

Returns
Type Description
Func<System.Object, Dictionary<System.String, System.Object>, System.Object>

Formatter delegate

| Improve this Doc View Source

DateTime(String, String)

Convert from one date time format to another

Declaration
public static Func<object, Dictionary<string, object>, object> DateTime(string from, string to = null)
Parameters
Type Name Description
System.String from

From format

System.String to

To format

Returns
Type Description
Func<System.Object, Dictionary<System.String, System.Object>, System.Object>

Formatter delegate

| Improve this Doc View Source

Explode(String)

Convert a string of values into an array for use with checkboxes.

Declaration
public static Func<object, Dictionary<string, object>, object> Explode(string delimiter = "|")
Parameters
Type Name Description
System.String delimiter

Delimiter to split on

Returns
Type Description
Func<System.Object, Dictionary<System.String, System.Object>, System.Object>

Formatter delegate

| Improve this Doc View Source

FromDecimalChar(Char)

Convert a number from using any character other than a period (dot) to one which does use a period.This is useful for allowing numeric user input in regions where a comma is used as the decimal character. Use with a set formatter.

Declaration
public static Func<object, Dictionary<string, object>, object> FromDecimalChar(char dec = ',')
Parameters
Type Name Description
System.Char dec

Decimal place character

Returns
Type Description
Func<System.Object, Dictionary<System.String, System.Object>, System.Object>

Formatter delegate

| Improve this Doc View Source

IfEmpty(Object)

Convert an empty string to null. Null values are very useful in databases, but HTTP variables have no way of representing null as a value, often leading to an empty string and null overlapping. This method will check the value to operate on and return null if it is empty.

Declaration
public static Func<object, Dictionary<string, object>, object> IfEmpty(object emptyValue)
Parameters
Type Name Description
System.Object emptyValue

Value to use if an empty value is submitted

Returns
Type Description
Func<System.Object, Dictionary<System.String, System.Object>, System.Object>

Formatter delegate

| Improve this Doc View Source

Implode(String)

Convert an array of values from a checkbox into a string which can be used to store in a text field in a database.

Declaration
public static Func<object, Dictionary<string, object>, object> Implode(string delimiter = "|")
Parameters
Type Name Description
System.String delimiter

Delimiter to join on

Returns
Type Description
Func<System.Object, Dictionary<System.String, System.Object>, System.Object>

Formatter delegate

| Improve this Doc View Source

NullEmpty()

Convert an empty string to null. Null values are very useful in databases, but HTTP variables have no way of representing null as a value, often leading to an empty string and null overlapping. This method will check the value to operate on and return null if it is empty.

Declaration
public static Func<object, Dictionary<string, object>, object> NullEmpty()
Returns
Type Description
Func<System.Object, Dictionary<System.String, System.Object>, System.Object>

Formatter delegate

| Improve this Doc View Source

ToDecimalChar(Char)

Convert a number with a period (dot) as the decimal character to use a different character(typically a comma). Use with a get formatter.

Declaration
public static Func<object, Dictionary<string, object>, object> ToDecimalChar(char dec = ',')
Parameters
Type Name Description
System.Char dec

Decimal place character

Returns
Type Description
Func<System.Object, Dictionary<System.String, System.Object>, System.Object>

Formatter delegate

  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX