Want to know how to specify multiple fields in Keystone.js List Map.
For example, based on the Keystone Data Model documentation:
http://keystonejs.com/docs/database/
var keystone = require('keystone'),
Types = keystone.Field.Types;
var Post = new keystone.List('Post', {
autokey: { path: 'slug', from: 'title', unique: true },
map: { name: 'title' },
defaultSort: '-createdAt'
});
Post.add({
title: { type: String, required: true },
state: { type: Types.Select, options: 'draft, published, archived', default: 'draft' },
author: { type: Types.Relationship, ref: 'User' },
createdAt: { type: Date, default: Date.now },
publishedAt: Date,
image: { type: Types.CloudinaryImage },
content: {
brief: { type: Types.Html, wysiwyg: true, height: 150 },
extended: { type: Types.Html, wysiwyg: true, height: 400 }
}
});
Post.defaultColumns = 'title, state|20%, author, publishedAt|15%'
Post.register();
Can I make use of both title and author to create a map, such that both 2 fields will be used in foreign Model Relationship?
var Post = new keystone.List('Post', {
autokey: { path: 'slug', from: 'title', unique: true },
map: { name: 'author, title' },
defaultSort: '-createdAt'
});
I got an "undefined" in Admin UI.