mistic100 / mistic100/jQuery-QueryBuilder

Hierarchical structure

Open
#949 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.7k
Forks
544
PR merge metrics
No merged PRs in 30d

Description

Hi ,
I wanted to create a hierarchy using this plugin, Right now what i saw, is it groups the rules together ,but they are not in any hierarchical structure.
Can i customize this plugin, if so how?

{
"condition": "AND",
"rules": [
{
"id": "price",
"field": "price",
"type": "double",
"input": "number",
"operator": "less",
"value": 10.25
},
{
"condition": "OR",
"rules": [
{
"id": "category",
"field": "category",
"type": "integer",
"input": "select",
"operator": "equal",
"value": 2
},
{
"id": "price",
"field": "price",
"type": "double",
"input": "number",
"operator": "equal",
"value": 1
}
]
},
{
"id": "name",
"field": "name",
"type": "string",
"input": "text",
"operator": "equal",
"value": "Test"
}
],
"valid": true
}

SO as per this eg:
image

price, group(category & price) and name they all are in same level, but what if i want to define that group(category & price) inside the price(1st block) so that when i do get rules, i should get something like this.

Please help.

This is what i am expecting to create a json:
{
"condition": "AND",
"rules": [
{
"id": "price",
"field": "price",
"type": "double",
"input": "number",
"operator": "less",
"value": 10.25,
"rules": [
{
"condition": "OR",
"rules": [
{
"id": "category",
"field": "category",
"type": "integer",
"input": "select",
"operator": "equal",
"value": 2
},
{
"id": "price",
"field": "price",
"type": "double",
"input": "number",
"operator": "equal",
"value": 1
}
]
}
]
},
{
"id": "name",
"field": "name",
"type": "string",
"input": "text",
"operator": "equal",
"value": "Test",
"rules": []
}
],
"valid": true
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named; start by tracing the plugin's current rule/group model and the get rules serialization path. Confirm the intended nesting semantics and existing UI/API constraints; done means a tested way to produce the requested nested JSON without flattening sibling rules.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, jquery
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.