Keystonejs(版本 4)列表可排序选项未反映在模板上

Keystonejs (version 4) list sortable option not reflecting on template

我正在尝试按名称对客户列表中的图像进行排序。它们在管理员 UI 上排序,但同样的排列并未反映在网站模板上

const keystone = require('keystone');
const Types = keystone.Field.Types

const storage = new keystone.Storage({
    adapter: require('keystone-storage-adapter-s3'),
    s3: {
      key:process.env.S3_KEY,
      secret: process.env.S3_SECRET,
      bucket: process.env.S3_BUCKET,
      region: process.env.S3_REGION,
      path: '/',
      uploadParams: { // optional; add S3 upload params; see below for details
        ACL: 'public-read',
      },
    },
    schema: {
      bucket: true, // optional; store the bucket the file was uploaded to in your db
      etag: true, // optional; store the etag for the resource
      path: true, // optional; store the path of the file in your db
      url: true, // optional; generate & store a public URL
    },
  });

const Clients = new keystone.List('Clients',{
    map: { name: 'name' },
    autokey: { path: 'slug', from: 'name', unique: true },
    sortable:true,

});

Clients.add({
    name:{type:String},
    logo:{ type: Types.File, storage: storage },
    website:{type:Types.Url}
})


Clients.register()

我通过在查询列表时添加 .sort() 方法解决了这个问题。将可排序选项添加到新列表时,会创建一个名为 'sortOrder' 的字段。所以在我的 clients.js 上,我这样查询:

let clients = keystone.list('Clients');

view.query('clients', clients.model.find().sort('sortOrder');