i have a content in enyo which i want to change dynamically. I have named it Name
{name:"Name", content: "", style: "font-weight: bold; line-height: 30px"},
I have a function in another js script which gets the content dynamically and send its back to a js function on this page. I am getting the content back correctly (i.e the variable result has content) but i do not know how to then assign it to the content variable as the function is a js function outside of the enyo functions.
I thought something like this would work but it doesnt. Basically i want to know how i can set the Name value from outside the enyo.kind. var name is not getting defined.
function setName(result){
var name = parent.$.Name;
name.setContent(result);
}
This perhaps not the right way in Enyo to do things..But just so you wanted, I have made it work. You may take a look:
//Kind definition in separate JS file
enyo.kind({
name:'Parent',
components:[
{name:'Name', content: "OldContent", style:"font-weight: bold; line-height: 30px"}
]
});
// Another JS file
var a= new Parent(); //Get kind object reference
a.renderInto(document.body);
function Change(result){
a.$.Name.setContent(result);
};
Change('NewContent');