I'm having troubles trying to hide the ID column, auto-generated by Keystone List template. Is there a way to suppress this column? The documentation is pretty scant covering only basic usage of the framework.
Is there a way to hide the ID column in Keystone.js?
Asked Answered
The ID column shows up when there isn't a "name" field that can be used to link to the details view in the Admin UI (or when the name field isn't being displayed).
You can't hide it, or rather we need something that can be used to attach the link to. You can, however replace it with any other name
or text
field using the map
feature.
For example, if you wanted to use a key
column as the "linking" / identifier property in your model:
var MyList = new keystone.List('MyList', {
map: { name: 'key' }
});
MyList.add({
key: String // this will be used wherever a "name" is required, instead of the ID
});
It's covered in the List Options in the docs.
Thanks. I figured it out though. I found out that this would do also: MyList.mappings = { name: 'key' }; –
Pressley
The List Options link you provided is throwing a 404. –
Lento
© 2022 - 2024 — McMap. All rights reserved.