jQuery-QueryBuilder
jQuery-QueryBuilder copied to clipboard
Add support to read only state.
Merge request checklist
- [ x ] I read the guidelines for contributing
- [ x ] I created my branch from
dev
and I am issuing the PR todev
- [ x ] I didn't pushed the
dist
directory - [ x ] Unit tests are OK
- [ x ] If it's a new feature, I added the necessary unit tests
- [ x ] If it's a new language, I filled the
__locale
and__author
fields
Pull request summary
This pull request add "read_only" option support to jQuery QueryBuilder core. This option could be changed with "setOptions" call. When set true, the query will be set read only with a simple overlay. It'll use CSS pointer-events. It's compatible with all browsers except "Opera Mini". If you think it will fit better as a plugin, please let me know on this request, than I'll request another push with a plugin code.
Hello, thank you for your PR.
- Please respect the general code-style (braces on same line)
- you can simplify the code in "setOptions" by using toggleClass
- I don't think it's pertinent to change the opacity of the whole builder. Instead buttons and inputs should be disabled and sort handles (from "sortable" plugin) be hidden. It is less straithforward but will be better for the UX/UI.
Thanks for your promptly response! I've fixed code-style and changed from CSS overlay to disable any interactive element (also, ignore drag at sortable plugin if readonly).
Ok it's quite straithforward actually (didn't know the :input
selector) !
I'll test it soon.
Added some fixes when read_only:
- At template, add "disabled" tag if read_only;
- At reset, make sure elements are read_only;
- At init, added setTimeout() call to wait DOM refresh, otherwise will not add disable property.