私は Sencha を初めて使用し、パネルの DataView の下にボタンを取得しようとしています。さまざまなシナリオを試しました。
景色
Ext.define('MyApp.view.Profile', {
extend : 'Ext.Panel',
xtype : 'profileview',
requires : ['MyApp.store.UserStore', 'Ext.List', 'Ext.DataView', 'Ext.data.Store'],
initialize : function() {
var me = this;
var record = 1;
//Create the instance of the store and load it
var userStore = Ext.create('MyApp.store.UserStore');
userStore.load();
//Create the dataview
var view = Ext.create('Ext.DataView', {
store : userStore,
itemTpl : ['<h1>Mijn Profiel</h1>', '<h2>{USERNAME}</h2>', '<p>{EMAIL}</p><br/>', '<img src="http://www.MyApp.nl/{AVATAR_PATH}" />', '<br/>'].join()
});
//Add the dataview to the panel
me.add(view);
/**
var button = Ext.create('Ext.Button', {
text : 'Edit',
handler : function() {
Ext.Msg.alert('You clicked the button');
}
});
*/
//me.add(button);
},
config : {
title : 'Profiel',
iconCls : 'user3',
scrollable : true,
styleHtmlContent : true,
items : [{
xtype : 'button',
text : 'Edit',
handler : function() {
Ext.Msg.alert('You clicked the button');
}
}]
}
});
上のビューにはボタンのみが表示され、Dataview は表示されません。追加する必要がありました
layout : 'fit'
構成に追加して、DataView を表示させます。しかし、ボタンと組み合わせると、ボタンがフルスクリーンになり、データビューが表示されなくなります (???)。
ボタンを構成項目として追加するシナリオと、ハンドラーを使用するシナリオの両方を試しました。
データビューの下にあるボタンを取得するにはどうすればよいですか??
ご協力いただきありがとうございます。