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

removeDataField: will remove the same datafield which has diffrent index #11

Open
Fuminhsg opened this issue Oct 30, 2020 · 0 comments
Open

Comments

@Fuminhsg
Copy link

I was trying to use visual.addDataField first to add new data fields and then use visual.removeDataField to remove old data fields.

For example, the initial dataFields is [dataField 1, dataField 2]. After addDataField, I got dataFields = [dataField 1(old), dataField 2(old), dataField 1(new), dataField 2(new)]. I want to remove the first two old dataFields in the array. But when I use:

            visual.getDataFields(dataRole).then((dataFields) => {
                  dataFields.forEach((datafield, index) => {
                    if (index < 2) {
                      visual.removeDataField(dataRole, 0);
                    }
                  });
                });

I expect to get dataFields = [dataField 1(new), dataField 2(new)], but I got dataFields = [ ] instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant