]>
git.proxmox.com Git - extjs.git/blob - extjs/examples/kitchensink/modern/src/view/YQL.js
2 * Demonstrates using YQL to fetch data from remote sources (in this case loading from the Sencha blog)
5 Ext
.require('Ext.data.JsonP', function() {
7 useAllPublicTables
: true,
8 yqlUrl
: 'http://query.yahooapis.com/v1/public/yql',
9 request: function(cfg
) {
10 var p
= cfg
.params
|| {};
13 if (this.useAllPublicTables
) {
14 p
.env
= 'store://datatables.org/alltableswithkeys';
17 Ext
.data
.JsonP
.request({
19 callbackKey
: 'callback',
21 callback
: cfg
.callback
,
22 scope
: cfg
.scope
|| window
27 Ext
.define('KitchenSink.view.YQL', {
28 extend
: 'Ext.Container',
35 styleHtmlContent
: true
41 text
: 'Load using YQL',
43 var panel
= Ext
.getCmp('YQL'),
44 tpl
= new Ext
.XTemplate([
46 '<div class="blog-post">',
47 '<h3><a href="{link}" target="_blank">{title}</a></h3>',
48 '<p>{description}</p>',
53 panel
.getParent().setMasked({
59 query
: "select * from rss where url='http://feeds.feedburner.com/sencha' limit 5",
60 callback: function(success
, response
) {
61 if (success
&& response
.query
&& response
.query
.results
) {
62 panel
.setHtml(tpl
.apply(response
.query
.results
));
65 Ext
.Msg
.alert('Error', 'There was an error retrieving the YQL request.', Ext
.emptyFn
);
68 panel
.getParent().unmask();