Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested Panels and nested questions are numbered incorrectly #9186

Open
Darkninja027 opened this issue Dec 18, 2024 · 2 comments
Open

Nested Panels and nested questions are numbered incorrectly #9186

Darkninja027 opened this issue Dec 18, 2024 · 2 comments
Assignees
Labels
user issue An issue or bug reported by users

Comments

@Darkninja027
Copy link

Describe the bug
Unable to create a consistent numbering on https://surveyjs.io/create-free-survey when using a nested numbering scheme.

Steps to reproduce

  1. Go to https://surveyjs.io/create-free-survey
  2. Set the JSON
{
  "logoPosition": "right",
  "pages": [
    {
      "name": "page1",
      "elements": [
        {
          "type": "panel",
          "name": "panel1",
          "title": "nya",
          "showNumber": true,
          "showQuestionNumbers": "onpanel",
          "questionStartIndex": "1.1",
          "elements": [
            {
              "type": "panel",
              "name": "panel2",
              "title": "inner",
              "showNumber": true,
              "showQuestionNumbers": "onpanel",
              "questionStartIndex": "1.1.1",
              "elements": [
                {
                  "type": "comment",
                  "name": "question1"
                }
              ]
            },
            {
              "type": "comment",
              "name": "question2"
            }
          ]
        },
        {
          "type": "panel",
          "name": "panel3",
          "title": "panel2",
          "showNumber": true,
          "showQuestionNumbers": "onpanel",
          "questionStartIndex": "1.1",
          "elements": [
            {
              "type": "panel",
              "name": "panel4",
              "title": "123",
              "showNumber": true,
              "showQuestionNumbers": "onpanel",
              "questionStartIndex": "1.1.1",
              "elements": [
                {
                  "type": "file",
                  "name": "question4"
                }
              ]
            },
            {
              "type": "comment",
              "name": "question3"
            }
          ]
        }
      ]
    }
  ],
  "questionStartIndex": "1"
}
  1. Look at panel 2

image

Expected behavior
I would have expected the inner panel to be 2.1 with question 4 being 2.1.1, and question 3 being 2.2 (like it is).

If I change panel 2 Question Indexing type to '2.1' then the nested panel is correctly numbered, but question 3 is not
image

image

@JaneSjs JaneSjs self-assigned this Dec 19, 2024
@JaneSjs JaneSjs added the user issue An issue or bug reported by users label Dec 19, 2024
@JaneSjs JaneSjs removed their assignment Dec 19, 2024
@andrewtelnov andrewtelnov self-assigned this Dec 20, 2024
@andrewtelnov
Copy link
Member

@Darkninja027 This PR will allow you to solve your issue.
It will add survey.onGetPanelNumber event that allows to implement the functionality you need.
Please check this unit test.

Thank you,
Andrew

@Darkninja027
Copy link
Author

Darkninja027 commented Jan 5, 2025

Hi andrew

I updated the package this morning and tested this implementation, however it still does not seem to work fully as expected

image

This image is from the surveyjs website demo

As you can see from the image I have a panel with the panel numbering starting at 3. i have set the numbering to restart on panel but the input questions displays 5.1 instead of the expected 3.1.

then when i attempt to do a panel -> panel -> question where the starting index is 3.2.1 the first question also has an incorrect value

image

it seems the way the question numbers are calculated may be incorrect.

image

however the numbering on the panels themselves seems to have resolved

If you would like me to log the internal question numbering being incorrect as a separate issue let me know and i will do so

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
user issue An issue or bug reported by users
Projects
None yet
Development

No branches or pull requests

3 participants