I need to know how to populate a Label with values from Store. In my Model i have defined a field called bookname. and i need to populate this label with the Book Name.
I know how to do this for a Grid, but don’t know how to do it for a Label or a Textfield.
In Grid;
{ text: "Book Name", dataIndex: 'bookname'},
But, how can we add values to Label and textfields.
UPDATE
i am still having the problem. I am unable to set the values to the Label. (after loading it from STORE). The Label gets displayed but it doesn’t get populated with the value that it got from STORE. There’s no error as such.
Ext.define('Ex.view.info', {
extend: 'Ext.window.Window',
alias: 'widget.info',
initComponent: function() {
var st = Ext.getStore('peopleinformation');
st.load();
this.items = [
{
xtype: 'label',
forId: 'myFieldId',
text: 'My Awesome Field',
name: 'personfirstname',
margins: '0 0 0 10'
}
];
this.callParent(arguments);
}
});
For just setting a value for label , you can use setText method described in label
http://docs.sencha.com/ext-js/4-0/#!/api/Ext.form.Label-method-setText
For textField – http://docs.sencha.com/ext-js/4-0/#!/api/Ext.form.field.Text-method-setValue
UPDATE:
UPDATE:
do you tried: