Hi!
How can I add custom function on filtering datatable loaded with parse function?
Server filtering doesn’t work if no url is specified.
How can I extend textFIlter to use ajax requests for example?
Foud solution:
webix.ui.datafilter.api_filter = {
getInputNode: function (node) {
return node.firstChild.firstChild;
},
getValue: function (node) {
return this.getInputNode (node).value;
},
setValue: function (node, value) {
this.getInputNode (node).value=value;
},
refresh: function (master, node, value) {
node.component = master.id;
master.registerFilter (node, value, this);
node._comp_id = master.id;
if (value.value && this.getValue (node) != value.value) {
this.setValue (node, value.value);
}
// Disable click events.
node.onclick = webix.html.preventEvent;
// Enable filter as type tracking.
webix.event (node, 'keydown', this._on_key_down);
},
render: function (master, config) {
if (this.init) this.init (config);
config.css = 'webix_ss_filter';
return "<input "+ (config.placeholder? ('placeholder="'+config.placeholder+'" '):"")+"type='text'>";
},
_on_key_down: function (e, node, value) {
var code = (e.which || e.keyCode);
// Ignore tab and navigation keys.
if (code == 9 || ( code >= 33 && code <= 40)) return;
if (this._filter_timer) window.clearTimeout (this._filter_timer);
this._filter_timer=window.setTimeout (function (){
api_request ();
},webix.ui.datafilter.textWaitDelay);
},
};
Hi,
you can set onBeforeFilter event:
on:{
onBeforeFilter: function(columnId, value, config){
/*your code*/
return false;
}
},
Thank you!