Could not set element for enum options when createView custom view of enum

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • trungtvmso
    Member
    • Jun 2022
    • 70

    Could not set element for enum options when createView custom view of enum

    I'm trying to create custom view of enum field for custom options depend on status field of parent view but I could not know how to set selector.

    here is my code:

    PHP Code:
    ....
    
    var modalCall = this.view.getMetadata().get("clientDefs.Call.modelViews.edit") || "views/modals/edit";
                Espo.Ui.warning("Loading..."),
                this.view.createView("quickCreate", modalCall, {
                    scope: "Call",
                    attributes: attributes,
                    headerText: this.view.model.get('name') + ' → ' + this.view.getLanguage().translateOption('Converted','leadStatus','ScotsOption'),
                    fullFormDisabled: !0,
                    backdrop: 'static',
                }, (callView => {
                    //callView.render(),
                    callView.createView('paymentType', 'views/fields/enum', {
                        model: callView.model,
                        mode: 'edit',
                        selector: '.field[data-name="paymentType"]',
                        defs: {
                            name: 'paymentType',
                            params: {
                                required: true,
                                options: ['Deposit', 'Paid in full'],
                                tooltip: 'Flexible payment type based on parentView'
                            }
                        }
                    }, paymentType => {
                        paymentType.render()
                    })
                    .then(() => {
                        callView.render(),.... 
    
    This is my console response when the view created:

    Click image for larger version

Name:	image.png
Views:	98
Size:	15.7 KB
ID:	109800

    Please help me to fix this problem. I'm very headache on this.​

    Thank you everyone
  • trungtvmso
    Member
    • Jun 2022
    • 70

    #2
    I have done to fix this.

    Thanks you all


    Here is how to fix it:

    PHP Code:
    callView.createView('paymentType', 'views/fields/enum', {
                        //.......
                    }, paymentType => {
                        callView.once('after:render', () => {
                            paymentType.render();
                        });
                    })

    Comment

    Working...