2017-09-22 13 views
0

グリッドでは、確認ボックスに「いいえ」ボタンをクリックすると、チェックボックスをオフにします。動いていない。確認ボックスをクリックします。いいえボタンをクリックし、グリッドチェックボックスのセルをオフにします。ExtJs

アクションがコントローラファイルで定義されている
Ext.create('Ext.grid.Panel', { 
columns : [ 
{ 
     xtype: 'checkcolumn', 
     id: 'device', 
     text: 'Device', 
     dataIndex: 'device', 
     checkboxToggle: true, 
     hidden: false, 
     action: "checkchange" 
} ] 
}); 

'Grid [action=checkchange]' { 
    checkchange: function (column, rowIndex) { 
     if (checked == true) { 
        Ext.MessageBox.confirm({ 
         cls: 'window-alert', 
         buttons: Ext.Msg.YESNO, 
         msg: 'Are you sure?', 
         fn: function (btn) { 
          if (btn === 'yes') { 

          } else { 
           var grid = column.up('Grid'); 
           var gridStore = grid.getStore(); 
           var rec = gridStore.getAt(rowIndex); 
           rec.get('device').checked = false; 
          } 
         } 
        }); 
       }  
      } 
     } 
    }); 
} 
+0

エラーがありますか? –

+0

エラーはありません – priya

答えて

0

私はそれがExtJs4に働いているかのデモを作成している

checkcolumnのcheckchangeためリスナーを使用してみてください。 2ここに表示されますSencha Fiddle

あなたの問題を解決するのに役立つことを願っています。

var store = Ext.create('Ext.data.Store', { 
     fields: ['name', 'email', 'phone', { 
      name: 'isChecked', 
      type: 'boolean', 
      defaultValue: false 
     }], 
     data: [{ 
      name: 'Lisa', 
      email: '[email protected]', 
      phone: '555-111-1224' 
     }, { 
      name: 'Bart', 
      email: '[email protected]', 
      phone: '555-222-1234' 
     }, { 
      name: 'Homer', 
      email: '[email protected]', 
      phone: '555-222-1244' 
     }, { 
      name: 'Marge', 
      email: '[email protected]', 
      phone: '555-222-1254' 
     }] 
    }); 

    Ext.create('Ext.grid.Panel', { 
     title: 'Simpsons', 
     store: store, 
     columns: [{ 
      xtype: 'checkcolumn', 
      width: 30, 
      sortable: false, 
      dataIndex: 'isChecked', 
      editor: { 
       xtype: 'checkbox', 
       cls: 'x-grid-checkheader-editor' 
      }, 
      listeners: { 
       checkchange: function (column, rowIndex, checked, record, e, eOpts) { 
        if (checked) { 
         Ext.MessageBox.confirm({ 
          cls: 'window-alert', 
          buttons: Ext.Msg.YESNO, 
          msg: 'Are you sure?', 
          fn: function (btn) { 
           if (btn === 'yes') { 
            column.up('grid').getSelectionModel().select(record, true, true) 
           } else { 
            column.up('grid').getStore().getAt(rowIndex).set('isChecked', false); 
           } 
          } 
         }); 
        } 
       } 
      } 
     }, { 
      text: 'Name', 
      dataIndex: 'name' 
     }, { 
      text: 'Email', 
      dataIndex: 'email', 
      flex: 1 
     }, { 
      text: 'Phone', 
      dataIndex: 'phone' 
     }], 
     height: 500, 
     width: '100%', 
     renderTo: Ext.getBody() 
    }); 
+1

ありがとうございます。その作業:) – priya

+0

大歓迎:) –

関連する問題