Skip to content

Commit db07009

Browse files
LuboZlubos.zlatohlavek
andauthored
triv: #23517 make fuzzy filtering optional - default false (#44)
* triv: #23517 make fuzzy filtering optional - default false * triv: #23517 make fuzzy filtering optional - default false * triv: #23517 make fuzzy filtering optional - default false * triv: #23517 loading settings in tree_widget.js, updated version --------- Co-authored-by: lubos.zlatohlavek <[email protected]>
1 parent 9ae4257 commit db07009

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "django-smartbase-admin"
3-
version = "0.2.97"
3+
version = "0.2.98"
44
description = ""
55
authors = ["SmartBase <[email protected]>"]
66
readme = "README.md"

src/django_smartbase_admin/admin/widgets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ def get_context(self, name, value, attrs):
559559
}
560560
context["widget"]["additional_columns"] = self.additional_columns
561561
context["widget"]["tree_strings"] = self.tree_strings
562-
562+
context["fancytree_filter_settings"] = {}
563563
return context
564564

565565
@classmethod

src/django_smartbase_admin/static/sb_admin/src/js/tree_widget.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ const loadValue = function ($inputEl, treeWidgetData, treeInstance) {
9595
indentation: 32,
9696
nodeColumnIdx: 0,
9797
}
98+
const fancytreeFilterSettings = window.loadJSONScriptData("fancytree_filter_settings")
9899
if (treeWidgetData.checkbox) {
99100
tableConfig.checkboxColumnIdx = 0
100101
tableConfig.nodeColumnIdx = 1
@@ -131,13 +132,14 @@ const loadValue = function ($inputEl, treeWidgetData, treeInstance) {
131132
autoApply: true, // Re-apply last filter if lazy data is loaded
132133
autoExpand: true, // Expand all branches that contain matches while filtered
133134
counter: false, // Show a badge with number of matching child nodes near parent icons
134-
fuzzy: true, // Match single characters in order, e.g. 'fb' will match 'FooBar'
135+
fuzzy: false, // Match single characters in order, e.g. 'fb' will match 'FooBar'
135136
hideExpandedCounter: true, // Hide counter badge if parent is expanded
136137
hideExpanders: true, // Hide expanders if all child nodes are hidden by filter
137138
highlight: true, // Highlight matches by wrapping inside <mark> tags
138139
leavesOnly: false, // Match end nodes only
139140
nodata: true, // Display a 'no data' status node if result is empty
140-
mode: "hide" // Grayout unmatched nodes (pass "hide" to remove unmatched node instead)
141+
mode: "hide", // Grayout unmatched nodes (pass "hide" to remove unmatched node instead)
142+
...fancytreeFilterSettings,
141143
},
142144
table: tableConfig,
143145
gridnav: {

src/django_smartbase_admin/templates/sb_admin/widgets/tree_base.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"filter_by_table_data": {% if filter_by_table_data %}true{% else %}false{% endif %}
4949
}
5050
</script>
51+
{{ fancytree_filter_settings|get_json_script:'fancytree_filter_settings' }}
5152
<script id="{{ tree_component_id }}_additional_columns" type="application/json">{{ tree_additional_columns|get_json|safe }}</script>
5253
<script id="{{ tree_component_id }}_tree_strings" type="application/json">
5354
{{ tree_strings|get_json|safe }}

0 commit comments

Comments
 (0)