2017-03-01 68 views
0

我創建了56個類別,當我試圖創建一個新的職位,當我要選擇我想要的類別只有50個。其他6個出現,而且即使通過鍵入不存在的類別名稱,也無法選擇它們。
我該如何解決這個問題?
這裏是車型顯示超過50個項目在管理用戶選擇

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

/** 
* Post Model 
* ========== 
*/ 

var Post = new keystone.List('Post', { 
    map: { name: 'title' }, 
    autokey: { path: 'slug', from: 'title', unique: true }, 
}); 

Post.add({ 
    title: { type: String, required: true }, 
    categories: { type: Types.Relationship, ref: 'PostCategory', many: true},// <- This is Shows only 50 instead of 56! 
    state: { type: Types.Select, options: 'draft, published, archived', default: 'published', index: true, required: true }, 
    publishedDate: { type: Types.Date, index: true, default: Date.now, required: true, dependsOn: { state: 'published' } }, 
    mainPDF: { type: Types.LocalFile, dest: 'public/pdf/mainpdf'}, 
    pronunciations: { type: Types.LocalFile, dest: 'public/pdf/pronunciations'}, 
    answers: { type: Types.LocalFile, dest: 'public/pdf/answers' }, 
}} 
    }); 

Post.schema.virtual('content.full').get(function() { 
    return this.content.extended || this.content.brief; 
}); 
Post.defaultColumns = 'title,categories|20%, publishedDate|20%'; 
Post.register(); 

回答

1

可以修改/node_modules/keystone/admin/api/list.js文件,並根據case: 'autocomplete'線(約26行)註釋掉的前三行。這隻適用於Keystone 3;我不知道這是一個問題還是Keystone 4,或者如果它是如何解決的話(這個文件位於不同的位置,我還沒有找到它)。新代碼應該是這樣的:

case 'autocomplete': 
    // var limit = Number(req.query.limit) || 50; 
    // var page = Number(req.query.page) || 1; 
    // var skip = limit * (page - 1); 

如果您從package.json下載Keystone在線(Heroku,Digital Ocean,Amazon S3),我不認爲這是可行的,除非您在NPM上創建Keystone 3和主機的分支。

+0

好吧,當我評論線路崩潰,但我改變了限制爲100現在它的罰款thnx的幫助 – Bill

相關問題