Code Monkey home page Code Monkey logo

Comments (7)

Mathou54 avatar Mathou54 commented on July 18, 2024 1

But why the data I pass is marked valid? (An object containing an array of array of string.)
This means the schema is the right one (or at least the schema and data are ok, maybe the layout is wrong).

from ajsf.

scottux avatar scottux commented on July 18, 2024 1

Removing the layout definition altogether displays the form as I think you expect it to be.

from ajsf.

RS-Roshi avatar RS-Roshi commented on July 18, 2024

Something is wrong with your schema..
You're saying array1 is array type its inside object is array type and in subarray there is a string object..
Array
_____subArray
______________string(inside the sub array)
And you're using layout to adjust the schema.. Layout is used to adjust the form widgets like input fields drop down.. Youre schema is invalid please get help from test examples first before writing ur schema

from ajsf.

RS-Roshi avatar RS-Roshi commented on July 18, 2024

But why the data I pass is marked valid? (An object containing an array of array of string.)
This means the schema is the right one (or at least the schema and data are ok, maybe the layout is wrong).

as by my thoughts of this library ,, layout is used to adjust the positioning and somethings like that kindly i refer you to check its given examples.

from ajsf.

joenarus avatar joenarus commented on July 18, 2024

This problem is being caused by a tandem of these two things inside of buildLayout:
code piece 1:

var nodeValue = JsonPointer.get(jsf.formValues, newNode.dataPointer.replace(/\/-/g, '/1'));

and code piece 2:

// Add any additional default items
                if (!newNode.recursiveReference || newNode.options.required) {
                    var arrayLength = Math.min(Math.max(newNode.options.tupleItems + newNode.options.listItems, isArray(nodeValue) ? nodeValue.length : 0), newNode.options.maxItems);
                    for (var i = newNode.items.length; i < arrayLength; i++) {
                        newNode.items.push(getLayoutNode({
                            $ref: itemRefPointer_1,
                            dataPointer: newNode.dataPointer,
                            recursiveReference: newNode.recursiveReference,
                        }, jsf, widgetLibrary));
                    }
                }

Based on how this parses layouts, it goes bottom up. If you have a child array, it will create its layout first. Then when it gets to the parent array, it will use code piece 2 to add items to the parent array based on the child it already created. It only creates one version of the child, which is where code piece 1 comes in. If you create data that has two elements in the parent and the second parent item has elements in the child array, the child array of the first parent element will have the same number of items as the second element. (This is because it's replacing the dataPointer dashes with a 1 always and not 0 or a correct index).

I am currently investigating a fix for this! Will respond back soon!

from ajsf.

github-actions avatar github-actions commented on July 18, 2024

Stale issue

from ajsf.

mkormendy avatar mkormendy commented on July 18, 2024

Another issue unresolved and closed by a bot .... @hamzahamidi Can you please reopen this issue?

from ajsf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.