Return value of the init function for custom condition.
Return value of the init function for custom condition.
ryan0987
Posts: 2Questions: 1Answers: 0
Custom Conditions example returns jQuery in the init function, but it seems that it does not work at least for the string type. I wrote the code below, and it didn't work for el, but worked for el[0]. Can you add some comment for this to the example?
conditions: {
string: {
"notContains": {
conditionName: "Not Contains",
init: function(that, fn, preDefined = null) {
const el = $('<input/>')
.addClass(that.classes.input)
.addClass(that.classes.value)
.on('input', function() {
fn(that, this);
});
return el[0]; // here
},
inputValue: function(el, that) {
return [$(el[0]).val()];
},
isInputValid: function(el, that) {
return $(el).val().trim().length > 0;
},
search: function(value, comparison) {
return value.toLowerCase().indexOf(comparison[0].toLowerCase()) === -1;
}
}
}
}
Answers
You can test the code here: http://live.datatables.net/losujisu/1/edit