mistic100 / mistic100/jQuery-QueryBuilder
calling 'reset' throws `TypeError: Cannot read properties of null (reading 'root')`
Open
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.7k
- Forks
- 544
- PR merge metrics
- No merged PRs in 30d
Description
When calling reset there is a console error:
$('#reset-querybuilder').click(function (){
$('#queryBuilder').queryBuilder('reset');
})


Maybe worth noting: I often recreate queryBuilder to change available options for "select" fields like:
function setQueryBuilderFilters(filters){
const currentOperators = query_builder[0].queryBuilder.operators
const currentRules = query_builder.queryBuilder('getRules', {skip_empty: true})
// recreate queryBuilder
query_builder.off('rulesChanged.queryBuilder');
$("#queryBuilder").queryBuilder("destroy");
const queryBuilderConfig = {
filters: filters,
operators: currentOperators,
rules: currentRules
}
$("#queryBuilder").queryBuilder(queryBuilderConfig);
set_query_builder_event()
}
There is no change in the behaviour, the resetting works as intended
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
Reproduce the issue with the shown #reset-querybuilder click handler and the destroy/recreate sequence in setQueryBuilderFilters. Trace the reset path to identify why it reads root from null; done means reset still works as intended without the console TypeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, jquery
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100