mistic100 / mistic100/jQuery-QueryBuilder
Rule properties missing in event hooks (Exception: TypeError: Cannot read property 'data' of undefined at Rule.get [as data]....)
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.7k
- Forks
- 544
- PR merge metrics
- No merged PRs in 30d
Description
I enjoy the way this plug-in works, in fact I am trying to implement on top of it. From the documentation I understand that the room I have to implement custom features is mostly in event hooks, however, the parameters provided in these hooks are incomplete.
For example, I cannot access a rule's data or error from the Rule object provided in the getRuleFilters callback (or in any other as far as I know...). Instead, I only get the rule's reference with no properties initialized other than its id and $el.
$('#builder').on('getRuleFilters.queryBuilder.filter', (filters, rule) => {
// Shows all the properties of `Rule` after it's been initialized
console.log(rule);
// But actually, properties such as `data`, `error`, `filter`, `flags` are all undefined
console.log(_.cloneDeep(rule));
});
TL;DR: How do I get the full Rule object in event hooks?
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 by tracing the getRuleFilters.query-builder.filter event and the Rule object supplied to its callback. Compare the initialized Rule shown in the issue with the object exposed in the hook, focusing on data, error, filter, and flags. Done means event hooks provide the full Rule properties rather than only id and $el, without the reported 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