Skip to content

Commit

Permalink
new: New language option for the joiner between two input elements, i…
Browse files Browse the repository at this point in the history
….e. the and in between conditions

Jira Issue DD-1719
  • Loading branch information
SandyDatatables committed Nov 6, 2020
1 parent 4bc213f commit 30794a2
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 2 deletions.
37 changes: 37 additions & 0 deletions docs/option/language.searchBuilder.valueJoiner.xml
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8" ?>
<dt-option library="SearchBuilder">
<name>language.searchBuilder.valueJoiner</name>
<summary>Set the placeholder text for the SearchBuilder value select element</summary>
<since>1.0.0</since>

<type type="string | object">
<description>
`-init language.searchBuilder.valueJoiner` changes what will be displayed between the two input elements, when a two part condition is selected (like between).
</description>
</type>

<default value="and" />

<description>
<![CDATA[
This will set the text between the two value input elements, by default this is `'and'`. This language option is available in custom conditions and plugins also.
]]>
</description>

<example title="Change text for SearchBuilder Value"><![CDATA[
$(document).ready(function() {
$('#example').DataTable( {
language: {
searchBuilder: {
valueJoiner: 'et'
}
},
dom: 'Qlfrtip',
});
});
]]></example>

<related type="init">searchBuilder.conditions[type]</related>

</dt-option>
1 change: 1 addition & 0 deletions examples/customisation/language.xml
Expand Up @@ -24,6 +24,7 @@ $(document).ready(function() {
_: 'Filters (%d)'
},
value: 'Option',
valueJoiner: 'et'
}
},
dom: 'Qlfrtip',
Expand Down
5 changes: 3 additions & 2 deletions src/criteria.ts
Expand Up @@ -254,7 +254,7 @@ export default class Criteria {
.addClass(Criteria.classes.input)
.on('input', function() { fn(that, this); }),
$('<span>')
.addClass(that.classes.joiner).text('and'),
.addClass(that.classes.joiner).text(that.s.dt.i18n('searchBuilder.valueJoiner', that.c.i18n.valueJoiner)),
$('<input/>')
.addClass(Criteria.classes.value)
.addClass(Criteria.classes.input)
Expand Down Expand Up @@ -322,7 +322,7 @@ export default class Criteria {
.on('input change', function() { fn(that, this); }),
$('<span>')
.addClass(that.classes.joiner)
.text('and'),
.text(that.s.dt.i18n('searchBuilder.valueJoiner', that.c.i18n.valueJoiner)),
$('<input/>')
.addClass(Criteria.classes.value)
.addClass(Criteria.classes.input)
Expand Down Expand Up @@ -1116,6 +1116,7 @@ export default class Criteria {
_: 'Custom Search Builder (%d)',
},
value: 'Value',
valueJoiner: 'and'
},
logic: 'AND',
orthogonal: {
Expand Down
1 change: 1 addition & 0 deletions src/group.ts
Expand Up @@ -119,6 +119,7 @@ export default class Group {
_: 'Custom Search Builder (%d)',
},
value: 'Value',
valueJoiner: 'and'
},
logic: 'AND',
orthogonal: {
Expand Down
2 changes: 2 additions & 0 deletions src/searchBuilder.ts
Expand Up @@ -71,6 +71,7 @@ export interface II18n {
_: string;
};
value: string;
valueJoiner: string;
}

export interface IS {
Expand Down Expand Up @@ -173,6 +174,7 @@ export default class SearchBuilder {
_: 'Custom Search Builder (%d)',
},
value: 'Value',
valueJoiner: 'and'
},
logic: 'AND',
orthogonal: {
Expand Down

0 comments on commit 30794a2

Please sign in to comment.