当前位置: 动力学知识库 > 问答 > 编程问答 >

node.js - 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.

网友答案:

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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: