4

I am new to vuejs. I am trying to generate nested textboxes on run time on a button click event. Please check jsfiddle link for better understanding https://jsfiddle.net/avi_02/qLqvbjvx/

Let's assume like this to understand the problem.

++ -> It generate MainTextBox

+ -> It generate SubTextBox

When I click on ++ then a new MainTextBox generates with a + link for SubTextBox But when I click on + to generate a SubTextBox then it gets generated on all other MainTextBox.

I want to generate SubTextBox for respective MainTextBox only not for other main textboxes. Please follow jsfiddle link for visual understanding.

1
  • I am trying to implement it with two dimensional arrays but that is also not working, please suggest Commented Oct 5, 2017 at 2:35

1 Answer 1

1

Each rowsMain needs its own array of components.

addRowMain() {
  this.form.rowsMain.push({
    key: '',
    value: '',
    componentRows: []
  });
}

And then you could add the component rows like:

addRowMainComponent(index) {
  this.form.rowsMain[index].componentRows.push('')
}

It still needs work, but see this updated fiddle:

https://jsfiddle.net/qLqvbjvx/5/

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks @Alex . I'll carry on from hereafter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.