Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

case-insensitive search #20

Open
trading-developer opened this issue Dec 1, 2023 · 1 comment
Open

case-insensitive search #20

trading-developer opened this issue Dec 1, 2023 · 1 comment

Comments

@trading-developer
Copy link

trading-developer commented Dec 1, 2023

Hello! thank you for the work you have done. The plugin is very good, here is a small fix to make it even better, this is a case-insensitive search, I gave the entire method, but in fact there is only q.toLowerCase()

`
this.searchShow = function (c, q, items) {
var content = '';
var select = '';
if ($.xtsStore[c].selectablePrernt) {
select = '';
}
for (var ix in items) {
var clsx = ' class="xli" ';
var itm = items[ix];
if (itm[$.xtsStore[c].json.title].toString().toLowerCase().indexOf(q.toLowerCase()) !== -1 || itm[$.xtsStore[c].json.value].toString().indexOf(q.toLowerCase()) !== -1) {
if (itm[$.xtsStore[c].json.child] != undefined && itm[$.xtsStore[c].json.child].length > 0) {
clsx = ' class="xli xtsel-childer" ';
content += '<li' + clsx + ' data-id="' + itm.idx + '" data-value="' + itm[$.xtsStore[c].json.value] + '">' + select + itm[$.xtsStore[c].json.title] + '';
content += $.xts.searchShow(c, q.toLowerCase(), itm[$.xtsStore[c].json.child]);
} else {
content += '<li' + clsx + ' data-id="' + itm.idx + '" data-value="' + itm[$.xtsStore[c].json.value] + '">' + itm[$.xtsStore[c].json.title] + '';
}
} else {
if (itm[$.xtsStore[c].json.child] != undefined && itm[$.xtsStore[c].json.child].length > 0) {
content += $.xts.searchShow(c, q.toLowerCase(), itm[$.xtsStore[c].json.child]);
}
}
}
return content;

    }

`

@A1Gard
Copy link
Member

A1Gard commented Dec 20, 2023

You can do it with pull request bro

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants