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

Dynamic Schema issues in array #101

Open
wants to merge 3 commits into
base: master
from

Conversation

Projects
None yet
4 participants
@nagarajanchinnasamy
Copy link
Contributor

commented Sep 9, 2017

When using dependsOn between properties of an object placed in an array, encountered various issues. Please use the examples provided in examples folder to test scenarios below:

Issue 1:

When an item is added by clicking Add Item button, received Uncaught Type Error: element.equals is not a function exception.

01_elementequals

Issue 2:

After fixing issue-1, using the following steps:

  1. Add an item
  2. Remove the item
  3. Add the item again

received Uncaught TypeError: cannot read property 'type' of undefined exception

02_addlevel1item_delete_againadd

Issue 3:

After fixing issue-2, using the following steps (in example2.html):

  1. Add Level-1 Item
  2. Add Level-2 Item
  3. Select "OPTION-2" in drop-down

received Uncaught TypeError: cannot read property '$ref' of undefined exception.

03_addlevel2item_selectoption-2

Issue 4:

After fixing issue-3, noticed that, dependency change is effective only in the last item of the array. Other items do not react to change in the drop-down value. This I feel something to do with depencyMap. But could not figure out a solution for this. Need help. Thanks.

@@ -177,6 +177,7 @@ if (typeof brutusin === "undefined") {
} else if (s.media) {
input = document.createElement("input");
input.type = "file";
appendChild(input, option, s);

This comment has been minimized.

Copy link
@nagarajanchinnasamy

nagarajanchinnasamy Sep 18, 2017

Author Contributor

Addition of this line is unintended. I will remove this line from my version and resubmit the pull request.

} else if (s.format === "date") {
input.type = "date";
} else if (s.format === "time") {
input.type = "time";
} else if (s.format === "email") {

This comment has been minimized.

Copy link
@nagarajanchinnasamy

nagarajanchinnasamy Sep 18, 2017

Author Contributor

Deletion of above 4 lines unintended. Will add these in my version and re-submit the pull request.

@@ -204,7 +205,7 @@ if (typeof brutusin === "undefined") {
}
}
if (s.enum.length === 1)
input.selectedIndex = 0;
input.selectedIndex = 1;

This comment has been minimized.

Copy link
@nagarajanchinnasamy

nagarajanchinnasamy Sep 18, 2017

Author Contributor

This must be:
input.selectedIndex = 0;

Will change and re-submit

if (value === true || value !== false && s.default) {
input.checked = true;
if (value === true) {
input.checked = true;

This comment has been minimized.

Copy link
@nagarajanchinnasamy

nagarajanchinnasamy Sep 18, 2017

Author Contributor

Changes in above 2 lines are unintended. Will revert and re-submit

@@ -1311,7 +1307,7 @@ if (typeof brutusin === "undefined") {

function cleanSchemaMap(schemaId) {
for (var prop in schemaMap) {
if (prop.startsWith(schemaId)) {
if (prop.startsWith(schemaId)) { // 02_AddLevel1Item_Delete_AgainAdd.png
delete schemaMap[prop];
}
}

This comment has been minimized.

Copy link
@nagarajanchinnasamy

nagarajanchinnasamy Sep 18, 2017

Author Contributor

Surprisingly, in the origin itself, the code differs between src and dist!!!

src has this fix... but dist doesn't have the fix.

@KiSchulte

This comment has been minimized.

Copy link

commented Sep 27, 2017

@nagarajanchinnasamy Thank you this pull request fixed all my open issues.
@idelvall +1 for merging this pull request

@machinaeXphilip

This comment has been minimized.

Copy link

commented Aug 2, 2018

thank you! fixed issues i had as well with dynamically build arrays with distinct fieldnames
hope this can be merged soon into @idelvall 's master !

@ma-hack

This comment has been minimized.

Copy link

commented Jan 22, 2019

thank you very much for the implementation!

With the getData method, the generated elements are not displayed. The error occurs when the first element had an addition and the next element makes a schema change.

image

Than getData has the result:
data: {"speciesList":[{"species":"dog"},{"species":"human"}]}

With only one Entry the result is:
data: {"speciesList":[{"species":"dog","subspecies":"bulldog"}]}

How did you fix the problem? Does it happen to you too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.