Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

The expand/collapse button not rendered for top-level fields #252

Open
stanch opened this issue May 24, 2016 · 2 comments
Open

The expand/collapse button not rendered for top-level fields #252

stanch opened this issue May 24, 2016 · 2 comments

Comments

@stanch
Copy link

stanch commented May 24, 2016

Although it works in the demo, in our code the arrow is missing (left of “items”):

screenshot from 2016-05-24 16 46 28

Here is how attributes-kit is being used:

require.config({
    paths: {
        'react': 'https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min',
        'react-dom': 'https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min',
        'attributes-kit': 'https://npmcdn.com/attributes-kit/dist/attributes-kit-no-react'
    }
});

var dataStructures = ...;
var element = ...;
var target = ...;

require([
    'react',
    'react-dom',
    'attributes-kit'
], function(React, ReactDom, AttributesKit) {
    var component = React.createElement(AttributesKit.Attributes, {
        element: element,
        dataStructures: dataStructures,
        collapseByDefault: true,
        namedTypes: false,
        title: 'hide'
    });
    ReactDom.render(component, target);
});
@XVincentX
Copy link
Contributor

Would it be possible to provide the used dataStructures object?

@stanch
Copy link
Author

stanch commented May 24, 2016

It happens with this basic MSON:

# Data Structures

## Payment

- items (array) - The list of items that were paid for.
    - (Item)

## Item

- quantity: 3 (number) - The purchased quantity of this specific item.
var dataStructures = [
  {
    "element": "object",
    "meta": {
      "id": "Payment"
    },
    "content": [
      {
        "element": "member",
        "meta": {
          "description": "The list of items that were paid for."
        },
        "content": {
          "key": {
            "element": "string",
            "content": "items"
          },
          "value": {
            "element": "array",
            "content": [
              {
                "element": "Item"
              }
            ]
          }
        }
      }
    ]
  },
  {
    "element": "object",
    "meta": {
      "id": "Item"
    },
    "content": [
      {
        "element": "member",
        "meta": {
          "description": "The purchased quantity of this specific item."
        },
        "content": {
          "key": {
            "element": "string",
            "content": "quantity"
          },
          "value": {
            "element": "number",
            "content": 3
          }
        }
      }
    ]
  }
];

var element = {
  "element": "object",
  "meta": {
    "id": "Payment"
  },
  "content": [
    {
      "element": "member",
      "meta": {
        "description": "The list of items that were paid for."
      },
      "content": {
        "key": {
          "element": "string",
          "content": "items"
        },
        "value": {
          "element": "array",
          "content": [
            {
              "element": "Item"
            }
          ]
        }
      }
    }
  ]
};

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

No branches or pull requests

2 participants