Show / Hide Table of Contents

Class Options

The Options class provides a convenient method of specifying where Editor should get the list of options for a select, radio or checkbox field. This is normally from a table that is left joined to the main table being edited, and a list of the values available from the joined table is shown to the end user to let them select from.

Options instances are used with the Field.Options() method.

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

Methods

| Improve this Doc View Source

Add(String)

Add a manually defined option to the list from the database

Declaration
public Options Add(string label)
Parameters
Type Name Description
System.String label

Label and value

Returns
Type Description
Options

Self for chaining

| Improve this Doc View Source

Add(String, Object)

Add a manually defined option to the list from the database

Declaration
public Options Add(string label, object value)
Parameters
Type Name Description
System.String label

Label

System.Object value

Value

Returns
Type Description
Options

Self for chaining

| Improve this Doc View Source

AddFromEnum<T>(Boolean)

Add a manually defined option to the list from the database

Declaration
public Options AddFromEnum<T>(bool useValueAsKey = true)
Parameters
Type Name Description
System.Boolean useValueAsKey
Returns
Type Description
Options

Self for chaining

Type Parameters
Name Description
T
| Improve this Doc View Source

Label()

Get the column name(s) for the options label

Declaration
public IEnumerable<string> Label()
Returns
Type Description
IEnumerable<System.String>

Column name(s)

| Improve this Doc View Source

Label(IEnumerable<String>)

Set multiple column names for the options label

Declaration
public Options Label(IEnumerable<string> label)
Parameters
Type Name Description
IEnumerable<System.String> label

Column names

Returns
Type Description
Options

Self for chaining

| Improve this Doc View Source

Label(String)

Set the column name for the options label

Declaration
public Options Label(string label)
Parameters
Type Name Description
System.String label

Column name

Returns
Type Description
Options

Self for chaining

| Improve this Doc View Source

LeftJoin(String, String, String, String)

Add a left join condition to the Options instance, allowing it to operate over multiple tables.

Declaration
public Options LeftJoin(string table, string field1, string op = null, string field2 = null)
Parameters
Type Name Description
System.String table

Table name to do a join onto

System.String field1

Field from the parent table to use as the join link

System.String op

Join condition (=, '<`, etc)

System.String field2

Field from the child table to use as the join link

Returns
Type Description
Options

Self for chaining

| Improve this Doc View Source

Limit()

Get the current limit

Declaration
public int Limit()
Returns
Type Description
System.Int32

Limit

| Improve this Doc View Source

Limit(Int32)

Set the limit for the number of options returned. NOTE if you are using SQL Server, make sure you also set an Order option.

Declaration
public Options Limit(int limit)
Parameters
Type Name Description
System.Int32 limit

Number of records to limit to

Returns
Type Description
Options

Self for chaining

| Improve this Doc View Source

Order()

Get the order by clause for the options

Declaration
public string Order()
Returns
Type Description
System.String

Order by string

| Improve this Doc View Source

Order(String)

Set the order by clause for the options

Declaration
public Options Order(string order)
Parameters
Type Name Description
System.String order

Order by SQL statement

Returns
Type Description
Options

Self for chaining

| Improve this Doc View Source

Render()

Get the rendering function

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

Rendering function

| Improve this Doc View Source

Render(Func<Dictionary<String, Object>, Object>)

Set the rendering function for the option labels

Declaration
public Options Render(Func<Dictionary<string, object>, object> renderer)
Parameters
Type Name Description
Func<Dictionary<System.String, System.Object>, System.Object> renderer

Rendering function. Called once for each option

Returns
Type Description
Options

Self for chaining

| Improve this Doc View Source

Table()

Get the table configured to read the options from

Declaration
public string Table()
Returns
Type Description
System.String

Table name

| Improve this Doc View Source

Table(String)

Set the table to read the options from

Declaration
public Options Table(string table)
Parameters
Type Name Description
System.String table

Table name

Returns
Type Description
Options

Self for chaining

| Improve this Doc View Source

Value()

Get the value column name

Declaration
public string Value()
Returns
Type Description
System.String

Value column name

| Improve this Doc View Source

Value(String)

Set the value column name

Declaration
public Options Value(string value)
Parameters
Type Name Description
System.String value

Column name

Returns
Type Description
Options

Self for chaining

| Improve this Doc View Source

Where()

Get the WHERE function used to apply conditions to the options select

Declaration
public Action<Query> Where()
Returns
Type Description
Action<Query>

Function

| Improve this Doc View Source

Where(Action<Query>)

Set a function that will be used to apply conditions to the options select

Declaration
public Options Where(Action<Query> where)
Parameters
Type Name Description
Action<Query> where

Function that will add conditions to the query

Returns
Type Description
Options

Self for chaining

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