如何在数据视图中的tpl中的div上添加一个按钮?

时间:2014-11-07 21:30:36

标签: html extjs render store dataview

我在尝试在tpl中添加按钮时遇到问题。我在面板内有这个。我想通过此按钮上传文件。它在itemClick监听器中获取的记录,我可以编辑并保存数据库中的记录,但我想上传一个文件。

items:{
  height: 310,
  bind: '{somestore}',
  id: 'somestore-panel',
  xtype: 'dataview',
  columnWidth: '100',
  tpl: [
   '<tpl for="." >',
     '<div id="upload-button" ></div>',
   '</tpl>'
  ]
  cls: 'div-selection',

  overItemCls: 'over-selection',

  listeners: {
    'itemclick': 'onClickDataButton',
    afterrender:function(){
      var button = new Ext.Button({
        renderTo:'upload-button',
        xtype: 'filefield',
        text:'Vote',
        width:100,
        id:'upload-form',
        handler:function(){
          alert('Vote Button is clicked');
        }
      })
      console.log(button);
   }
 }
}

并返回

  

无法读取null

的属性'dom'

如果我不使用按钮,所有商店都会正确无误,我不知道是否有更好的方法来添加组件。

0 个答案:

没有答案
相关问题