実行時に作成されるボタンを表示するアプリが必要です。その理由は、サービスから情報を取得して、必要なボタンの数を確認するためです。
現在、プログラムは実行されていますが、ボタンは表示されません。
ツールバーを使用して、create 関数でコントロール プロパティを設定しようとしています。プログラムは正常に実行されますが、ツールバーにボタンがありません。これを行う方法はありますか?
コード:
// Trying to create buttons at run time
name: "MyApps.MainApp",
kind: enyo.VFlexBox,
components: [
{kind: "PageHeader", content: "Template"},
{kind: "Toolbar", name: "tabsted"},
{name: "feedUrl", kind: "Input", flex: 1},
{kind: "HtmlContent", name: "comments", content: "hello world <br> and another lin"},
{name:"curValue", content:("Sample Text \r\n and more")},
{kind: "Button", caption: "Action", onclick: "btnClick"},
],
// this gets called first ha
create: function()
{
this.inherited(arguments);
this.$.tabsted.components= [
{caption: "a"},
{caption: "b"},
{caption: "c"}
];
this.LoadCommments();
},
LoadCommments: function()
{
this.$.comments.content="fred";
},
// called when button is clicked
btnClick: function()
{
this.$.curValue.setContent("Put some text here"); // handle the button click
}
};