question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

jsonb field not showing up in SHOW/EDIT

See original GitHub issue

Describe the bug A clear and concise description of what the bug is.

Installed libraries and their versions

To Reproduce Steps to reproduce the behavior: I am trying to display and enable edit for one of my models that has a JSONB datatype.

instructor model

const Instructor = sequelize.define('Instructor', {
    id: {
        type: Sequelize.INTEGER,
        autoIncrement: true,
        primaryKey: true
    },
    submission: {
        type: DataTypes.JSONB,
        allowNull: false
    },
}, {});

resource definition

const adminBro = new AdminBro({
    resources: [{resource: Provider}, {
        resource: Instructor,
        options: {
            properties: {
                submission: {
                    type: 'mixed',
                    show: true,
                    filter: false,
                    edit: true
                },
            },
        }
    }],
})

const router = AdminBroExpress.buildRouter(adminBro)

app.use(adminBro.options.rootPath, router)

Here is the UI result in admin: enter image description here

Expected behavior should display json data and be able to edit it.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
dzirafcommented, Apr 16, 2021
submission: { type: 'mixed' },
'submission.element': { type: 'mixed' },
'submission.element.type': { type: 'string' },
'submission.element.attr': { type: 'string; },
...etc

Similarly for arrays, i.e.

items: { type: 'mixed', isArray: true },

If you want to have an array of i. e. { label: 'string', value: 'number' }:

'items.label': { type: 'string' },
'items.value': { type: 'number' },

I’ve also recently added isDraggable option which works if isArray is true:

items: { type: 'mixed', isArray: true, isDraggable: true },

It allows you to reorder elements in JSONB arrays

2reactions
imaithalcommented, Jan 20, 2022

In my case i don’t have predefined structure for json. How can I show this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

jsonb field not showing up in SHOW/EDIT · Issue #796 - GitHub
I am trying to display and enable edit for one of my models that has a JSONB datatype. instructor model. const Instructor =...
Read more >
Developers - jsonb field not showing up in SHOW/EDIT -
A clear and concise description of what the bug is. Installed libraries and their versions. admin-bro@2.0.1; admin-bro-expressjs@2.0.0; @admin- ...
Read more >
Got column doesn't exist when query nested jsonb field in ...
The tax column has type jsonb . but I got this error if I select the nested feePercent field: select "uuid", "tax"->"feePercent" from...
Read more >
Datatable – Lightning Web Component for Flow Screens
All you need to do is drag it onto the flow screen in the Flow Builder and give it a collection of records...
Read more >
9.4: JSON Functions and Operators - PostgreSQL
JSON fields that do not appear in the target row type will be omitted from the output, and target columns that do not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found