Skip to content

Commit dba287f

Browse files
authored
Merge pull request #97 from mendix/feat/lvc-searchtext-no-search
[WC-530] only retrieve the search text if search is enabled to prevent error
2 parents c2721f1 + d190f6d commit dba287f

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66

77
## [Unreleased]
88

9-
## 1.3.12 - 2021-05-27
9+
### Fixed
10+
11+
- Fixed an issue introduced in v1.3.12 where if the list view's search is not enabled, then the widget would error on any list view control widget interaction.
12+
13+
## 1.3.12 - 2021-05-27 [YANKED]
1014

1115
### Fixed
1216

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "list-view-controls",
33
"widgetName": "ListViewControls",
4-
"version": "1.3.12",
4+
"version": "1.3.13",
55
"description": "Search and filter Mendix list views",
66
"copyright": "Mendix BV",
77
"scripts": {

src/Shared/DataSourceHelper/DataSourceHelper.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export interface DataSourceHelperListView extends mxui.widget.ListView {
2626
__customWidgetPagingLoading: boolean;
2727
__customWidgetPagingOffset: number;
2828
_getSearchText?: () => string;
29+
hasSearch: boolean;
2930
}
3031

3132
export class DataSourceHelper {
@@ -182,7 +183,8 @@ export class DataSourceHelper {
182183

183184
// @ts-ignore This is a subclass property, but we also handle it gracefully if not present.
184185
const searchPaths: string[] | undefined = this.widget._datasource._searchPaths;
185-
const searchText: string | undefined = this.widget._getSearchText?.();
186+
// If there is no search, trying to get it will error so first check whether search is enabled.
187+
const searchText: string | undefined = this.widget.hasSearch ? this.widget._getSearchText?.() : undefined;
186188

187189
// Unfortunately the listview datasource object does not have a `_getSearchConstraints()` function of some kind,
188190
// but rather builds it on the fly in `setSearchText(string)`. To not affect the ListView widget, we copy that part

src/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<package xmlns="http://www.mendix.com/package/1.0/">
3-
<clientModule name="ListViewControls" version="1.3.12" xmlns="http://www.mendix.com/clientModule/1.0/">
3+
<clientModule name="ListViewControls" version="1.3.13" xmlns="http://www.mendix.com/clientModule/1.0/">
44
<widgetFiles>
55
<widgetFile path="CheckBoxFilter/CheckBoxFilter.xml"/>
66
<widgetFile path="DropDownFilter/DropDownFilter.xml"/>

0 commit comments

Comments
 (0)