mistic100 / mistic100/jQuery-QueryBuilder

Using nb_inputs: 2 with select inputs

Open
#996 1 comment 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


Title:

How to Render Dual Selects with Options in Rule_Value Section

Body:

Description:
I'm working on a project where I need a rule that requires two select inputs in the rule_value section. I'm attempting to create a rule where a user can select values from two different dropdowns. However, I'm encountering difficulties in understanding how to properly supply these select inputs with their respective options.

Code Snippet:

{
    "condition": "AND",
    "rules": [
        {
            "id": "159",
            "field": "159",
            "type": "collection_string",
            "input": "select",
            "operator": "In",
            "value": [262, 261],
            "nb_inputs": 2,
            "values": {
                0: [ /* first select options */ ],
                1: [ /* second select options */ ]
            }
        }
    ],
    "valid": true
}

image

Specific Issue:

I am not clear on how to populate the values object for both selects. Should these options be set in rule.filters? I need guidance on how to format this part of the configuration, specifically how to properly define and pass the option values for each select input.

Attempts:

I have looked through the documentation but couldn't find a clear example or explanation that fits this specific scenario. I also checked the provided examples and tried modifying them to suit my needs but with no success. Further I have tried passing in a values prop like the one above.

Request:

Could you provide an example or guidance on how to correctly set up dual select inputs within a rule, including how to supply each select input with a set of options? A small code example or a reference to the relevant part of the documentation would be greatly appreciated.

Environment:

jQuery-QueryBuilder version: 0.1.2
Browser: Edge 122.0.2365.52
Thank you in advance for your assistance!

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

Start with the existing documentation and examples for nb_inputs, select inputs, rule_value, and filter configuration in jQuery-QueryBuilder 0.1.2; compare them with the reported values object and rule.filters question. Done means providing or documenting a clear dual-select configuration example, including how each select receives its options.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, jquery
Domain
documentation, frontend
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.