1

I am using KeystoneJS for Admin DB management. I have a field of type Types.Code in one of my models. I have configured it as below in the model configuration -

Constant.add({
    name: { type: String, index: true, required: true, noedit: true },
    data: { type: Types.Code, height: 180, language: 'json', noedit: false},
    created_at: { type: Date, default: Date.now, noedit: true },
    updated_at: { type: Date, default: Date.now, noedit: true }
});

A sample Db entry looks like this:

{
    "_id" : ObjectId("5915bd0e995abe638b847897"),
    "name" : "constant1",
    "data" : {
        "value" : 0.5
    },
    "created_at" : ISODate("2017-04-07T06:39:21.725Z"),
    "updated_at" : ISODate("2017-04-07T06:39:21.725Z")
}

But when I visit the page of an entry from this model I see a blank text area.

JSON date not loaded in the view

Apparently, Codemirror is loading fine when I check browser console. The only issue is that the data is not loading in the view. Need help in figuring this out.


Update

I have been able to get the data but it is not parsing as JSON in the UI. There is a somewhat similar question - Mongoose schema types in KeystoneJS models But it doesn't answer how to show nested objects in KeystoneJS UI.

Keystone Team had replied to a tweet about this https://twitter.com/KeystoneJS/status/453438728485089280

There is an open PR on this issue too - https://github.com/keystonejs/keystone/pull/3282

Kshitij
  • 639
  • 1
  • 10
  • 25

0 Answers0