[FIX] HORILLA VIEWS: Toggle column select all unselect script not working issue
This commit is contained in:
@@ -29,7 +29,14 @@ class ToggleColumnForm(forms.Form):
|
||||
Toggle column form
|
||||
"""
|
||||
|
||||
def __init__(self, columns, default_columns, hidden_fields: list, *args, **kwargs):
|
||||
def __init__(
|
||||
self,
|
||||
columns,
|
||||
default_columns,
|
||||
hidden_fields: list,
|
||||
*args,
|
||||
**kwargs,
|
||||
):
|
||||
request = getattr(_thread_locals, "request", {})
|
||||
self.request = request
|
||||
super().__init__(*args, **kwargs)
|
||||
@@ -38,7 +45,7 @@ class ToggleColumnForm(forms.Form):
|
||||
if column[1] in hidden_fields:
|
||||
initial = False
|
||||
if not hidden_fields:
|
||||
if column not in default_columns:
|
||||
if default_columns and column not in default_columns:
|
||||
initial = False
|
||||
self.fields[column[1]] = forms.BooleanField(
|
||||
label=column[0], initial=initial
|
||||
|
||||
@@ -3,10 +3,18 @@
|
||||
<input type="hidden" name="path" value="{{request.path_info}}">
|
||||
<ul class="oh-dropdown__items">
|
||||
<div class="oh-dropdown_btn-header">
|
||||
<button class="oh-btn oh-btn--success-outline">
|
||||
<button onclick="
|
||||
$(this).closest('form').find('[type=checkbox]').prop('checked',true);
|
||||
$(this).closest('form').find('[type=checkbox]').siblings('input[type=hidden]').val('');
|
||||
$(this).closest('form').find('[type=submit]').click();
|
||||
" class="oh-btn oh-btn--success-outline">
|
||||
{% trans "Select All Records" %}
|
||||
</button>
|
||||
<button class="oh-btn oh-btn--primary-outline">
|
||||
<button onclick="
|
||||
$(this).closest('form').find('[type=checkbox]').prop('checked',false);
|
||||
$(this).closest('form').find('[type=checkbox]').siblings('input[type=hidden]').val('off');
|
||||
$(this).closest('form').find('[type=submit]').click();
|
||||
" class="oh-btn oh-btn--primary-outline">
|
||||
{% trans "Unselect All Records" %}
|
||||
</button>
|
||||
</div>
|
||||
@@ -28,5 +36,5 @@
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<input type="submit" hidden>
|
||||
<input type="submit">
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user