SoftwareBrothers / adminjs

AdminJS is an admin panel for apps written in node.js
https://adminjs.co
MIT License
8.21k stars 662 forks source link

You have to specify "recordId" for record action #417

Closed DimaDevel closed 4 years ago

DimaDevel commented 4 years ago

I got an error while trying to go to the /admin/resources/User page Error: you must specify "recordId" for the record action

Installed libraries and their versions

How can I fix this error?

wojtek-krysiak commented 4 years ago

did you make some modifications? custom components?

DimaDevel commented 4 years ago

No, I didn't make any modifications. I tried to use a snippet of code from your documents. But I got an error. Can I set recordId in the config?

shathaku commented 4 years ago

Facing similar issue. I was trying to add AdminBro to my existing application.

Installed libraries:

"admin-bro": "^2.2.7", "admin-bro-expressjs": "^2.0.4", "admin-bro-sequelizejs": "^0.4.0"

shathaku commented 4 years ago

I think i got the issue . Suppose this is my Model.

const testUser = sequelizeClient.define('TestUser', { id: { type: DataTypes.STRING, allowNull: false, primaryKey: true, field: 'ID' }, fullName: { type: DataTypes.STRING, allowNull: true, field: 'Fullname' }, role: { type: DataTypes.STRING, allowNull: true, field: 'Role' }, email: { type: DataTypes.STRING, allowNull: true, field: 'Email' } }

Here, the attribute name does not exactly match the 'field' name I provided for the attribute. Once i made them exactly same (matching the case) it started working. Like this:

const testUser = sequelizeClient.define('TestUser', { id: { type: DataTypes.STRING, allowNull: false, primaryKey: true, field: 'id' }, fullName: { type: DataTypes.STRING, allowNull: true, field: 'fullName' }, role: { type: DataTypes.STRING, allowNull: true, field: 'role' }, email: { type: DataTypes.STRING, allowNull: true, field: 'email' } }

Now i would like to know, what could we do in case i want my 'field' value different from the attribute name.