PDA

View Full Version : Binding JSON result to Label.



RKenkre
2 May 2016, 2:19 AM
Hi All,

Actually I am using ext JS 3.2.1 version and I want to bind the JSON result as the text of my label. Tried few ways but not achieved the desired result.

Below is the method that returns JSON result:

BannerDetail: new Ext.data.JsonStore({
root: 'showbanner',
storeId: 'BannerDetail',
idProperty: 'Description',
//autoload: true,
fields: ['Description'],
//name: [lblOutage],
init: function () {

var mask = new Ext.LoadMask(
Ext.getBody(),
{
msg: "Please wait...",
store: BannerDetail

}
);
mask.show();
this.load({
callback: function (record, options, success) {
if (!success) {
Ext.MessageBox.alert('Error', 'Unable to retrieve banner messages.');
}
}
});
},
proxy: new Ext.data.HttpProxy({
method: 'POST',
timeout: 2700000,
url: 'Outage/showbanner' --> returning json result
})
}),

And the code of my label is:
{ xtype: 'label',
bodyStyle: 'background-color: transparent;',
cls: 'x-form-item scroll-left',
text: "" --> Even I want to know how to format the label text with html tags.
name: 'lblOutage',
},

Using above code, I am constantly getting the error message "Unable to retrieve banner messages." which I have written in the above method.

Please advice how to achieve this.

Thanks in advance.

Gary Schlosberg
3 May 2016, 7:39 AM
You might try formatting your code for better readability or better yet post a test case. As far as HTML tags, can you utilize the tpl (http://docs.sencha.com/extjs/3.4.0/#!/api/Ext.form.Label-cfg-tpl) of the label?