Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to hide the ID column in Keystone.js?

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.

like image 534
Cristi Potlog Avatar asked Oct 20 '15 14:10

Cristi Potlog


1 Answers

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.

like image 72
Jed Watson Avatar answered Nov 10 '22 03:11

Jed Watson