diff --git a/src/ComboSelector/ComboSelector.xml b/src/ComboSelector/ComboSelector.xml
index 08be604..bd40e30 100644
--- a/src/ComboSelector/ComboSelector.xml
+++ b/src/ComboSelector/ComboSelector.xml
@@ -140,6 +140,15 @@
Specify a microflow to execute on change of the attribute. (optional)
+
+ Search method
+ Behavior
+ Base the search on contain or match with the start of the item.
+
+ Contains
+ Starts with
+
+
Autocomplete
Behavior
diff --git a/src/ComboSelector/lib/XpathStore.js b/src/ComboSelector/lib/XpathStore.js
index ee75814..f6dbd6d 100644
--- a/src/ComboSelector/lib/XpathStore.js
+++ b/src/ComboSelector/lib/XpathStore.js
@@ -12,6 +12,7 @@ define([
associationDisplay: "",
XpathDeferred: "",
data: "",
+ searchMethod: "",
constructor: function (options) {
this.id = options.caller + '.XpathStore';
@@ -19,6 +20,7 @@ define([
this.dataSourceXpathLimit = options.dataSourceXpathLimit;;
this.sortParams = options.sortParams;
this.associationDisplay = options.associationDisplay;
+ this.searchMethod = options.searchMethod;
logger.debug(this.id + ".constructor");
},
query: function (query, options) {
@@ -32,7 +34,8 @@ define([
if (query.name) {
var
searchString = query.name.toString().replace(/\'/g, ''').replace(/\"/g, '"'),
- xpathQuery = this.dataSourceXpath + "[contains(" + this.associationDisplay + ", '" + searchString + "')]";
+ xpathQuery = this.dataSourceXpath + "[" + this.searchMethod + "(" + this.associationDisplay + ", '" + searchString + "')]";
+ console.log("xpathQuery: " + xpathQuery);
mx.data.get({
xpath: xpathQuery,
filter: {
diff --git a/src/ComboSelector/widget/ComboSelector.js b/src/ComboSelector/widget/ComboSelector.js
index 76e6e6f..2301abf 100644
--- a/src/ComboSelector/widget/ComboSelector.js
+++ b/src/ComboSelector/widget/ComboSelector.js
@@ -67,6 +67,7 @@ define([
dataSourceXpathSortOrder: "",
dataSourceXpathExecution: "",
reloadOnRefresh: "",
+ searchMethod: "",
// Internal variables. Non-primitives created in the prototype are shared between all widget instances.
@@ -79,6 +80,7 @@ define([
_association: null,
_entity: null,
_sortParams: null,
+ _searchMethodWidget: null,
// dojo.declare.constructor is called to construct the widget instance. Implement to initialize non-primitive properties.
constructor: function () {
@@ -107,6 +109,12 @@ define([
dojoClass.add(this.inputWrapper, "col-sm-" + (12 - this.labelWidth));
}
+ if (this.dataSourceSelection == "dataSourceMicroflow" || this.dataSourceXpathExecution == "widget"){
+ this._searchMethodWidget = (this.searchMethod == 'contains' ? "*${0}*" : "${0}*");
+ } else {
+ this._searchMethodWidget = (this.searchMethod == 'contains' ? "contains" : "starts-with");
+ }
+
this._association = this.associationEntity.split("/")[0];
this._entity = this.associationEntity.split("/")[1];
@@ -172,6 +180,7 @@ define([
dataSourceXpathLimit: this.dataSourceXpathLimit,
sortParams: this._sortParams,
associationDisplay: this.associationDisplay,
+ searchMethod: this._searchMethodWidget
});
this._buildComboBox();
} else if (this.dataSourceSelection == "dataSourceXpath" && this.dataSourceXpathExecution == "widget") {
@@ -218,7 +227,7 @@ define([
if (!this._comboBox) {
this._comboBox = new dojoComboBox({
store: this._comboBoxStore,
- queryExpr: (this.dataSourceSelection == "dataSourceXpath" && this.dataSourceXpathExecution == "xpath" ? "${0}" : "*${0}*"),
+ queryExpr: (this.dataSourceSelection == "dataSourceXpath" && this.dataSourceXpathExecution == "xpath" ? "${0}" : this._searchMethodWidget),
searchAttr: "name",
autoComplete: this.autoComplete,
searchDelay: this.searchDelay
diff --git a/src/package.xml b/src/package.xml
index d1fae6c..f01a7dc 100644
--- a/src/package.xml
+++ b/src/package.xml
@@ -1,6 +1,6 @@
-
+
diff --git a/test/widgets/ComboSelector.mpk b/test/widgets/ComboSelector.mpk
index 5d25ab4..c3c877b 100644
Binary files a/test/widgets/ComboSelector.mpk and b/test/widgets/ComboSelector.mpk differ