Quote from tvorimweby on April 21, 2024, 11:37
I found solution (posts-table-filterable/assets/js/filter.js). Can you extend your plugin in future update for this code?
'use strict';
class TABLEON_Filter {
// ... (rest of the code remains the same)
draw() {
// ... (rest of the code remains the same)
case 'textinput':
elem = document.createElement('input');
elem.setAttribute('data-key', key);
elem.setAttribute('type', 'search');
if (this.data[key]['minlength']) {
elem.setAttribute('minlength', this.data[key]['minlength']);
} else {
elem.setAttribute('minlength', 1);
}
elem.className = 'tableon-text-search';
if (this.data[key]['placeholder']) {
elem.setAttribute('placeholder', this.data[key]['placeholder']);
}
if (_this.dtable.request_data.filter_data[key]) {
elem.value = _this.dtable.request_data.filter_data[key];
}
// Adding autocomplete function
elem.addEventListener('keyup', function(e) {
if (this.value.length >= 2) {
_this.dtable.request_data.filter_data[key] = this.value;
_this.redraw_table();
}
});
this.dtable.attach_keyup_event(elem);
this.dtable.attach_mouseup_event(elem);
break;
// ... (rest of the code remains the same)
}
// ... (rest of the code remains the same)
}
I found solution (posts-table-filterable/assets/js/filter.js). Can you extend your plugin in future update for this code?
'use strict';
class TABLEON_Filter {
// ... (rest of the code remains the same)
draw() {
// ... (rest of the code remains the same)
case 'textinput':
elem = document.createElement('input');
elem.setAttribute('data-key', key);
elem.setAttribute('type', 'search');
if (this.data[key]['minlength']) {
elem.setAttribute('minlength', this.data[key]['minlength']);
} else {
elem.setAttribute('minlength', 1);
}
elem.className = 'tableon-text-search';
if (this.data[key]['placeholder']) {
elem.setAttribute('placeholder', this.data[key]['placeholder']);
}
if (_this.dtable.request_data.filter_data[key]) {
elem.value = _this.dtable.request_data.filter_data[key];
}
// Adding autocomplete function
elem.addEventListener('keyup', function(e) {
if (this.value.length >= 2) {
_this.dtable.request_data.filter_data[key] = this.value;
_this.redraw_table();
}
});
this.dtable.attach_keyup_event(elem);
this.dtable.attach_mouseup_event(elem);
break;
// ... (rest of the code remains the same)
}
// ... (rest of the code remains the same)
}