-
Notifications
You must be signed in to change notification settings - Fork 0
Settings
DataTabled OData plugin options. You can load a object with the default settings
// Default settings
var default = new DataTableOData.Settings();
var default = new DataTableOData.Settings('url');General options
| Name | Type | Default | Requiered | Sample |
|---|---|---|---|---|
| url | string | emtpy | true | '/odata/NorthwindModel' |
This is used as base url for every ajax request. This option is requiered
| Name | Type | Default |
|---|---|---|
| queryOrder | boolean | true |
Whether the odata $order parameter is supported or not
| Name | Type | Default |
|---|---|---|
| querySelect | boolean | true |
Whether the odata $select parameter is supported or not. Turn on for less overhead.
| Name | Type | Default |
|---|---|---|
| mapOperators | string[] | ODataComparisonOperatorsMap |
You can set custom compare operator if you like. The array must match the postions of the original map. This is mainly used for the column search function.
The default search input would be: "> 16" instead of 'gt 16' Both will be displayed as followed in the query:
// Options
{ data: "Name" },
// Search
var search = "== Peter";
dt.columns[1].search(search);
// The query will look like
$filter=Name eq 'Peter' and ...// Included maps
DataTableOData.ODataComparisonOperators = ["eq", "ne", "gt", "ge", "lt", "le", "has"];
DataTableOData.ODataComparisonOperatorsMap = ["==", "!=", ">", ">=", "<", "<=", "has"];| Setting | Type | Default | Options |
|---|---|---|---|
| searchColumns | boolean | true | |
| searchColumnsPlace | string | thead |
thead / tfoot
|
Whether column search is enabled or not. If is enabled a input for every column is created. You can control the position of the inputs row with the searchColumnsPlace parameter.
This options are set for every column.
Example:
// Colum names
{ data: "Name" },
or
{ name: "Name" },
// samples
{ data: "Name", type: "number", searchMethod: "contains" },
{ data: "Age" , type: "number" },
{ data: "Dogs", type: "number" },| Name | Type | Default | Options |
|---|---|---|---|
| searchMethod | string | empty | contains / endswith / startswith |
If this is set the input value is placed inside this function.
Example:
// Options
// If searchMethod is set for this column
{ data: "Phone", type: "number", searchMethod: "contains" },
// Search
var search = 123456;
dt.columns[1].search(search);
// The query will look like this
$filter=contains(Phone, 123456) and ...You can use the name and / or data option in the column settings. The difference is that dataTables uses internaly a array for the columns if the data paramter is missing. This means that the result from a OData request must exact match the order and the count of the columns in the table. This only wokrs if the OData $select method is supported. Best is you set both, then you can alway choose this via a flag.
If the OData method $select is not supported then you have to use the data paramter, as the resault set may not match the column order and count of your table.
| Name | Type | Default | Info |
|---|---|---|---|
| name | string | empty | If only name is passed than it has to match the OData property name |
| data | string | empty | OData property name |
This settings are build in DataTables options
| Name | Type | Default |
|---|---|---|
| type | string | empty |
Type of the column data. If this is not a numeric/number type than on a column search the value will be escaped
This setting is a build in DataTables option