<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>пример</title>
<script type='text/javascript' src='http://docs.sencha.com/ext-js/4-0/extjs/ext-all.js'></script>
<link rel="stylesheet" type="text/css" href="http://docs.sencha.com/ext-js/4-0/extjs/resources/css/ext-all.css">
<script>
Ext.onReady(function() {
var data = [
{
id: 1,
name: 'Andrew',
age: 20
}, {
id: 2,
name: 'Alex',
age: 43
}
];
var store = Ext.create('Ext.data.Store', {
data: data,
autoLoad: true,
fields: [
{ name: 'id', type: 'int' },
{ name: 'name', type: 'string' },
{ name: 'age', type: 'int' },
{ name: 'orders' }
]
});
var grid = Ext.create('Ext.grid.Panel', {
title: 'Demo',
tbar: [
{ xtype: 'button', text: 'Button 1' },
{ xtype: 'button', text: 'Button 2' },
{ xtype: 'button', text: 'Button 3' }
],
renderTo: Ext.getBody(),
store: store,
columns: [
{ dataIndex: 'id', hidden: true, hideable: false },
{ dataIndex: 'name', header: 'Name' },
{ dataIndex: 'age', header: 'Age', flex: 1 }
]
});
grid.getSelectionModel().on('selectionchange', function(sm){
// Находим все баттоны
var buttons = grid.query('button'),
rec = sm.getLastSelected();
// Например:
buttons[0].setDisabled(rec.get('age')>20);
});
});
</script>
<body>
</body>
</html>