sencha touch-2;将值存储到HTML中

时间:2013-02-18 22:03:56

标签: sencha-touch-2 sencha-architect

我有一个商店和模型来制作AJAX Call并获得结果。

这是我的观点

Ext.define('kids.view.YouTube', {
  extend: 'Ext.Component',
  alias: 'widget.YouTubePlayer',
  xtype: 'YouTube',

  config: {
    url: 'http://www.youtube.com/embed/',
    videoId: 'qsvpvqvApKo',
    vWidth: 420,
    vHeight: '315',
    styleHtmlContent: true,
    aaa: '1',
},
initialize: function() {
    var prod = Ext.create('kids.store.vids');
    prod.load(function ( ){ 
    prod.each(function (record, id){
        tmp = tmp + record.get('vid_url');
 });

  });
 this.callParent(arguments);
    var out = Ext.String.format(
      [
        '<div align="center">',
        '<iframe width="{0}" height="{1}" src="{2}"',
        'frameborder="0" allowfullscreen></iframe>',
        '</div>'
      ].join(''),
      this.getVWidth(),
      this.getVHeight(),
      **tmp //(the dynamic variable i formed in onLoad event of store**
    );
    console.log(tmp);

   this.setHtml(out);
}
 });

我使用了prod=ext.create('kids.store.vids'); 我正在使用onload函数,它正确地获取值。

我怎样才能在onload上使用tmp变量,因为变量变空了。并且在store.load(函数)内部我无法使用this.callParent()

h * 我可以在这里传递动态html,根据商店返回的值吗? *

帮帮我

1 个答案:

答案 0 :(得分:0)

谢谢 我使用了panel.setHtml来更新我从商店获得的变量中的html。

感谢