You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not sure if this is because we are on 8.0, but we have a few issues with the Dropdown cascading.
I think I solved some of them, but I'm pretty new to Mendix and have little JavaScript experience. Not sure if my changes will have bad side effects yet.
First, we were getting a parsing error with the constraint. The upperFilter wasn't spit correctly and the newLowerOptionFilter needed a "/". Wish I saw #29 earlier. Could have saved me 2 hours but my fix is the same.
Then we noticed it was not cascading to multiple listeners. I fixed this by changing the find() to a filter() with a forEach().
The last thing, which I haven't found a fix for, is multi-select will not cascade down all selections. I think the problem is that each filter in that case needs an OR put between. Not sure how this can be accomplished. For our app, I changed it to be single-select and it's not a critical need but would be nice to have. Any help here would be appreciated
Thank you,
Horace Tang
Here is my modified function:
_cascadeToListeningWidgets: function () {
// refresh the listening dropdown
//var listenerWidget = this._searchWidgets[this.targetGridClass].find(function (w) {
// return w.listenPath && w.listenKey === this.cascadeKey
//}.bind(this));
var listenerWidgets = this._searchWidgets[this.targetGridClass].filter(function (w) {
return w.listenPath && w.listenKey === this.cascadeKey
}.bind(this));
listenerWidgets.forEach(function(listenerWidget) {
// if there's a listening widget
if (listenerWidget) {
/**
* upper filter
* lower option filter
* lower filter
* the upper filter affects the lower option filter
* if the filter on the listenerWidget dropdown needs to change, clear it
* if the filter on the listenerWidget doesn't need to change, do nothing
*/
//var upperFilter = this._getSearchConstraint().split(listenerWidget.listenPath).slice(-1)[0]; // last item in array
var upperFilter = this._getSearchConstraint().split("/").slice(-1)[0];
if (upperFilter) {
var lowerOptionFilter = listenerWidget.searchWidget._datasource.getConstraints();
//var newLowerOptionFilter = "[(" + listenerWidget.listenPath + upperFilter;
var newLowerOptionFilter = "[(" + listenerWidget.listenPath + "/" + upperFilter;
if (lowerOptionFilter != newLowerOptionFilter) {
// set new constraint
listenerWidget.searchWidget._datasource.setConstraints(newLowerOptionFilter);
// reload
listenerWidget.searchWidget._datasource.reload();
// reinit
listenerWidget.searchWidget.reinit();
listenerWidget._clear();
}
} else {
listenerWidget.searchWidget._datasource.setConstraints();
// reload
listenerWidget.searchWidget._datasource.reload();
// reinit
listenerWidget.searchWidget.reinit();
listenerWidget._clear();
}
}
}, this);
}
The text was updated successfully, but these errors were encountered:
Not sure if this is because we are on 8.0, but we have a few issues with the Dropdown cascading.
I think I solved some of them, but I'm pretty new to Mendix and have little JavaScript experience. Not sure if my changes will have bad side effects yet.
First, we were getting a parsing error with the constraint. The upperFilter wasn't spit correctly and the newLowerOptionFilter needed a "/". Wish I saw #29 earlier. Could have saved me 2 hours but my fix is the same.
Then we noticed it was not cascading to multiple listeners. I fixed this by changing the find() to a filter() with a forEach().
The last thing, which I haven't found a fix for, is multi-select will not cascade down all selections. I think the problem is that each filter in that case needs an OR put between. Not sure how this can be accomplished. For our app, I changed it to be single-select and it's not a critical need but would be nice to have. Any help here would be appreciated
Thank you,
Horace Tang
Here is my modified function:
_cascadeToListeningWidgets: function () {
// refresh the listening dropdown
//var listenerWidget = this._searchWidgets[this.targetGridClass].find(function (w) {
// return w.listenPath && w.listenKey === this.cascadeKey
//}.bind(this));
}
The text was updated successfully, but these errors were encountered: