如何在Keystone.js中对列表进行排序?

时间:2019-02-11 08:34:03

标签: node.js keystonejs

我有一个梯形的模型

var keystone = require('keystone');

/**
 * Logs Model
 * ===================
 */
var Logs = new keystone.List('log', {
    map: { name: 'clientname' },
    track: true,
    noedit: true,
});

Logs.add({
    clientname: { type: String, trim: true },
    ingredientName: { type: String, trim: true, lowercase: true },
    upc: { type: String, trim: true },
    sku: { type: String, trim: true },
    handle: { type: String, trim: true },
    status: { type: String, trim: true },
    method: { type: String, trim: true },
    url: { type: String, trim: true },
    date: { type: Date },
});

/**
 * Registration
 */
Logs.defaultColumns = 'url, clientname, status, date';
Logs.register();

此数据的默认排序是按日期排序,我希望它按照客户端名称的降序排列。 我该如何实现?

0 个答案:

没有答案