mistic100 / mistic100/jQuery-QueryBuilder
number_nan gives validation error when I select multiple items
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.7k
- Forks
- 544
- PR merge metrics
- No merged PRs in 30d
Description
#895 I opened a numbered topic. I use selectize plugin according to suggestion
{
id: 'FkKadroBirimID',
label: 'Selectize',
type: 'integer',
plugin: 'selectize',
operators: ['equal','in'],
plugin_config: {
valueField: 'id',
labelField: 'title',
searchField: 'title',
sortField: 'title',
plugins: ['set_all'],
onInitialize: function () {
var that = this;
var url = '@Url.Action("GetBirimlerByBirimKod", "Helper", new { area = "Yonetim" })';
if (localStorage.birimData === undefined) {
$.getJSON(url, function (data) {
console.log("data server");
localStorage.birimData = JSON.stringify(data);
$.each(data.Data, function(i, item) {
that.addOption({
id: item.Value,
title: item.Text,
});
});
});
}
else {
console.log("data local");
$.each(JSON.parse(localStorage.birimData).Data, function (i, item) {
that.addOption({
id: parseInt(item.Value),
title: item.Text,
});
});
}
}
},
},

It works fine when I select one item.

gives number_nan validation error when I select multiple items
62:1263 Uncaught TypeError: Cannot read property 'sql' of null
at HTMLButtonElement.<anonymous> (62:1263)
at HTMLButtonElement.dispatch (jquery.min.js:3)
at HTMLButtonElement.r.handle (jquery.min.js:3)
this console output error.
How can I solve the error that occurs when I select more than one element.
var getRules = function() {
try {
var res = jqueryQueryBuilder.queryBuilder('getRules');
console.log("res",res);
convertSingleValuesToArray(res);
console.log("res2",res);
return res;
} catch (ex) {
return null;
}
}

res value appears to be null
batch select plugin I use
` Selectize.define('set_all', function (options) {
let self = this;
self.onKeyUp = (function (e) {
const original = self.onKeyUp;
return function (e) {
original.apply(this, arguments);
const code = e.originalEvent.code;
if (!(e.ctrlKey == true && e.shiftKey == true && code == 'KeyA')) {
return;
}
let optionsSelected = {};
self.currentResults.items.forEach((item) => {
optionsSelected[item.id] = self.options[item.id];
});
self.setValue(Object.keys(optionsSelected));
};
})();
});`
note: it gives the same validation error whether I select them individually or collectively
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the issue's selectize configuration and the getRules function, then reproduce the validation error with one selected item and with multiple items. Inspect the queryBuilder getRules result and the conversion step to identify why the multi-selection produces null or number_nan; done means multiple selections return valid rules without the reported error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100