Reputation: 11
I want add custom types to Ng-admin. I didn't find complete info or sample to do it. As a sample, I want add next types: embedded object, embedded_list type, parted combo box and others.
My confuse is what syntax and structure of TypeField and TypeFieldView files.
Upvotes: 1
Views: 639
Reputation: 7335
You custom type should extend the Field
type at least, or another existing type.
// in path/to/MyCustomDateField.js
// ES6 version
import DateField from 'admin-config/lib/Field/DateField';
export default class MyCustomDateField extends DateField {
formatSmall() {
return this.format('small');
}
}
// ES5 version
var DateField = require('admin-config/lib/Field/DateField');
function MyCustomDateField(name) {
DateField.call(this, name);
}
MyCustomDateField.prototype = new DateField();
MyCustomDateField.prototype.formatSmall = function() {
return this.format('small');
}
module.exports = MyCustomDateField;
As a side note, please don't post your question to too many places (e.g. here, in the ng-admin gitter, and in the ng-admin bugtracker). This gives us more work to provide support.
Upvotes: 2