【问题标题】:Ext JS: Adding listener to a Picker component in order to disable a separate buttonExt JS:将侦听器添加到 Picker 组件以禁用单独的按钮
【发布时间】:2018-02-03 00:42:32
【问题描述】:

我想向我的 School 组件添加一个侦听器,该组件是网格内的一列。 School 的 editor 字段的 xtype 扩展了 Ext JS Picker。基本上,监听器将有一个函数在绑定教室值时将 bindBool 设置为 true。

网格:

 xtype: 'grid',
            scrollable: 'y',
            maxHeight: 300,
            margin: 10,
            sortable: false,
            plugins: [{
                ptype: 'cellediting',
                clicksToEdit: 1,
                pluginId: 'gridEditor'

编辑器

{
  header: 'School',
  width: 300,
  dataIndex: 'classroom',
  renderer: function(value) {
      return value.classroomString;
  },
  editor: {
      xtype: 'classroomfield',
      bind: {
          value: '{classroom}'
          }
      }
}

祖鲁语按钮:

items: [{
    xtype: 'panel',
    buttons: [{
        style: 'margin-right: 30px',
        text: 'Zulu',
        iconCls: 'x-fa fa-upload',
        handler: 'xray',
        bind: {
                disabled: '{bindBool}'
        }
    }]
}]

【问题讨论】:

  • 不清楚你在问什么。为什么你认为它应该有所不同?
  • 当网格单元格中的数据从null更改时,我希望启用按钮。我不想实际编写代码来更新按钮中的值。

标签: javascript extjs


【解决方案1】:

在您的 viewModel 中:

formulas : {
    bindBool : {
       get : function(get){
           var class = get('classroom')
           return Ext.isEmpty(class) ? false : true;
        }
    }
}

【讨论】:

    猜你喜欢
    • 2012-11-26
    • 1970-01-01
    • 2021-03-21
    • 2015-02-04
    • 2011-07-20
    • 1970-01-01
    • 1970-01-01
    • 2011-09-13
    • 1970-01-01
    相关资源
    最近更新 更多