SEARCHBUILDER custom condition

SEARCHBUILDER custom condition

oh132oh132 Posts: 4Questions: 4Answers: 0

hello,

I have configured a datatable serverside with ajax call. Put searchbuilder , and it's ok.
I created a custom condition in searchbuilder In and notin string and num type.
Side string is ok but side num, when I put different value separated with space or comma, un final result is a concat of all value like 1 2 3 or 1,2,3 gives [123].

num: {
                    'in': {
                      conditionName: 'In',
                      init: function (that, fn, preDefined = null) {
                      var el = document.createElement('input');
                      el.addEventListener('input', function () {
                        fn(that, this);
                      });

                      if (preDefined !== null) {
                        el.value = preDefined[0];
                      }

                      return el;
                    },

                    inputValue: function (el) {
                      return el[0].value;
                    },

                    isInputValid: function (el, that) {
                      return el[0].value.length !== 0;
                    },

                    search: function (value, comparison) {
                      return value % comparison === 0;
                    }
                    },
                      'notin': {
                    conditionName: 'Not In',
                    init: function (that, fn, preDefined = null) {
                      var el = document.createElement('input');
                      el.addEventListener('input', function () {
                        fn(that, this);
                      });

                      if (preDefined !== null) {
                        el.value = preDefined[0];
                      }

                      return el;
                     },

                      inputValue: function (el) {
                        return el[0].value;
                      },

                      isInputValid: function (el, that) {
                        return el[0].value.length !== 0;
                      },

                      search: function (value, comparison) {
                        return value % comparison === 0;
                      }
                    }
                  }
                }
                }
            },

I want an array with all value separated.

Any idea ?

Sign In or Register to comment.