function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Amit Singh 1Amit Singh 1 

"Assertion Failed!: \"readonly\" must either be a public property of lightningDualListbox or a global HTML attribute : false"

Hi Folks,

I am getting Error while trying to create Dual List Dynamically using $A.createComponent

"Assertion Failed!: \"readonly\" must either be a public property of lightningDualListbox or a global HTML attribute : false"

Below is my JavaScript code
doInit : function(component, event, helper) {
        var options = [
            { value: "1", label: "Option 1" },
            { value: "2", label: "Option 2" },
            { value: "3", label: "Option 3" },
            { value: "4", label: "Option 4" },
            { value: "5", label: "Option 5" },
            { value: "6", label: "Option 6" },
            { value: "7", label: "Option 7" },
            { value: "8", label: "Option 8" },
        ];
        $A.createComponent(
            "lightning:dualListbox",
            {
                "aura:id": "findableAuraId",
                "label": "Dual List Demo",
                "selectedLabel":"Selected Options",
                "sourceLabel":"Available Options",
                "options" : options
            },
            function(dualList, status, errorMessage){
                //Add the new button to the body array
                if (status === "SUCCESS") {
                    var body = component.get("v.body");
                    body.push(dualList);
                    component.set("v.body", body);
                }
                else if (status === "INCOMPLETE") {
                    console.log("No response from server or client is offline."+
                                JSON.stringify(errorMessage))
                }
                    else if (status === "ERROR") {
                        console.log( JSON.stringify(errorMessage));
                    }
            }
        );
    }

Any help will be greatly appreciated. Thanks in Advance.

Thanks & Regards,
Amit
GhanshyamChoudhariGhanshyamChoudhari
can you post your component code?
Amit Singh 1Amit Singh 1
I am not sure it will make an impact Here it is
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />


    {!v.body}

</aura:component>

 
GhanshyamChoudhariGhanshyamChoudhari
It looks like a bug to me.
alternatively, you can use aura:if
Amit Singh 1Amit Singh 1
I need to create dynamically. aura:if will not work in my case.