I'm trying to create a new Component using Anguilla Framework with this code

increment = 0;

var publicationId = "tcm:0-xx-1"; var orgItemId = "tcm:xx-yy-2"; var schemaId = "tcm:xx-zz-8";

var item = $models.createNewItem($const.ItemType.COMPONENT); item.setPublication(publicationId); item.setOrganizationalItem(orgItemId); item.setDefaultSubType($const.ComponentSubType.COMPONENT);

var onLoad =  function() {
    $evt.removeEventHandler(item, "load", onLoad);
    var schema = $models.getItem(schemaId);

    var onInstanceDataLoad =  function()
        $evt.removeEventHandler(schema, "instancedataload", onInstanceDataLoad);

        item.setTitle("Test Title " + (increment++));
        item.setContent(schema.getInstanceData(orgItemId, true));
        item.save(true);    };

   $evt.addEventHandler(schema, "instancedataload", onInstanceDataLoad);

    schema.loadInstanceData(orgItemId); };

$evt.addEventHandler(item, "load", onLoad); item.load(true);

and it is working well and create the new Component, but when I try to open it, always show the message "Loading" in his title... If I want to open it, I've to close and open the browser...

enter image description here

Can anyone help me?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.