Discuss anything related to web development but no technical support questions


Post by Stanleyliu1006 »

Hi

I am wondering how can i easily move my customized field 'All allocation' to the top of the editor form in Sch.plugin.EditorWindow? Is this configurable (like define form field sequence)?

Please find details in my screenshot below.

Kind regards
Stanley
Attachments
Move_field_in_form.png
Move_field_in_form.png (26.41 KiB) Viewed 1390 times

Post by pmiklashevich »

Hello Stanley,

I'm afraid this part of code is not ready for that. Order is hardcoded in Sch.widget.EventEditor.initComponent and Sch.widget.EventEditor.loadRecord expects it to be the second item in array. You can override both (though they are private), but I can suggest you another way. This additional field container is a container with card layout. That means it can display different set of fields depending on EventType data field of your records. Therefore, if you don't need this extra functionality and you just want to provide your custom fields to the event editor, it's better to override protected Sch.widget.EventEditor.getDefaultFields and specify any fields you need there. this.callParent call returns all default fields, and you can change the order as you wish. Here is an example how to do that:
Ext.define(null, {
    override : 'Sch.widget.EventEditor',

    getDefaultFields : function () {
        var result = [];

        this.myCustomField = Ext.create({
            xtype      : 'textfield',
            fieldLabel : 'Test',
            name       : 'test'
        });

        result.push(this.myCustomField);

        return result.concat(this.callParent(arguments));
    }
});

Pavlo Miklashevych
Sr. Frontend Developer


Post Reply