Skip to content

Commit aaf6de9

Browse files
committed
Add sorting to widget configuration
1 parent f014716 commit aaf6de9

5 files changed

Lines changed: 43 additions & 4 deletions

File tree

443 Bytes
Binary file not shown.

src/BootstrapMultiSelectForMendix/BootstrapMultiSelect.xml

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,39 @@ iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lD
2525
<caption>Data constraint</caption>
2626
<category>Data source</category>
2727
<description>Optional constraint to filter the available options</description>
28-
</property>
28+
</property>
29+
<property key="sortContainer" type="object" isList="true" required="false">
30+
<caption>Sort order</caption>
31+
<category>Data source</category>
32+
<description>The sort order of the objects</description>
33+
<properties>
34+
<property key="sortAttribute" type="attribute" isPath="optional" pathType="reference" entityProperty="../dataAssociation">
35+
<caption>Attribute</caption>
36+
<category>Data source</category>
37+
<description>An attribute to sort on</description>
38+
<attributeTypes>
39+
<attributeType name="AutoNumber"/>
40+
<attributeType name="Boolean"/>
41+
<attributeType name="Currency"/>
42+
<attributeType name="DateTime"/>
43+
<attributeType name="Enum"/>
44+
<attributeType name="Float"/>
45+
<attributeType name="Integer"/>
46+
<attributeType name="Long"/>
47+
<attributeType name="String"/>
48+
</attributeTypes>
49+
</property>
50+
<property key="sortOrder" type="enumeration" defaultValue="asc">
51+
<caption>Order</caption>
52+
<category>Data source</category>
53+
<description>The order in which to sort</description>
54+
<enumerationValues>
55+
<enumerationValue key="asc">Ascending</enumerationValue>
56+
<enumerationValue key="desc">Descending</enumerationValue>
57+
</enumerationValues>
58+
</property>
59+
</properties>
60+
</property>
2961
<property key="showLabel" type="boolean" defaultValue="true">
3062
<caption>Show Label</caption>
3163
<category>Display</category>

src/BootstrapMultiSelectForMendix/widget/BootstrapMultiSelect.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
========================
44
55
@file : BootstrapMultiSelect.js
6-
@version : 1.3
6+
@version : 1.5
77
@author : Iain Lindsay
8-
@date : Thur, 24 Sep 2015 19:42:00 GMT
8+
@date : Mon, 30 Nov 2015 11:57:00 GMT
99
@copyright : AuraQ Limited 2015
1010
@license : Apache v2
1111
@@ -76,6 +76,7 @@ require({
7676
_$alertdiv: null,
7777
_$combo: null,
7878
_comboData : [],
79+
_sortParams : [],
7980

8081
constructor: function () {
8182
this._handles = [];
@@ -87,6 +88,12 @@ require({
8788
this._reference = this.dataAssociation.split('/')[0];
8889
this._labelAttribute = this.labelAttribute.split('/')[2];
8990

91+
// create our sort order array
92+
for(var i=0;i<this.sortContainer.length;i++) {
93+
var item = this.sortContainer[i];
94+
this._sortParams.push([item.sortAttribute, item.sortOrder]);
95+
}
96+
9097
// make sure we only select the control for the current id or we'll overwrite previous instances
9198
var selector = '#' + this.id + ' select.multiSelect';
9299
this._$combo = $(selector);
@@ -204,7 +211,7 @@ require({
204211
mx.data.get({
205212
xpath: xpath,
206213
filter: {
207-
sort: [[this._labelAttribute, "asc"]],
214+
sort: this._sortParams,
208215
offset: 0
209216
},
210217
callback: lang.hitch(this, this._processComboData)

test/Test.mpr

74 KB
Binary file not shown.
443 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)