1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
| var xg = Ext.grid;
var checkColumn = new Ext.ux.grid.CheckColumn({
header: 'indoor',
id:'indoor',
dataIndex: 'indoor',
width: 55,
xtype: 'booleancolumn',
});
var reader = new Ext.data.ArrayReader({
id:'indoor'
}, [
// {name: 'indoor', type: 'bool'},
{name: 'indoor', type: 'bool'},
{name: 'company'},
{name: 'price', type: 'float'},
{name: 'change', type: 'float'},
{name: 'pctChange', type: 'float'},
{name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'},
]);
var store = new Ext.data.Store({
url: 'grid.php',
reader: new Ext.data.JsonReader({
root:'rows',
id:'idd'
},[
//'idd',
{name:'idd',type:'float'},
//'idd',
'nom',
'prenom',
'service'
])
//,autoLoad: true
});
var nom_edit = new Ext.form.Checkbox();
var test_edit = new Ext.form.TextField();
var grid2 = new xg.EditorGridPanel({
store: new Ext.data.Store({
reader: reader,
data: xg.dummyData
}),
cm: new xg.ColumnModel({
defaults: {
width: 120,
sortable: true
},
columns: [
checkColumn,
{header: "Company", width: 200, dataIndex: 'company', editor:test_edit},
{header: "Price", renderer: Ext.util.Format.usMoney, dataIndex: 'price'},
{header: "Change", dataIndex: 'change'},
{header: "% Change", dataIndex: 'pctChange'},
{header: "Last Updated", width: 135, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'}
]
}),
columnLines: true,
clickstoEdit: 1,
listeners:{
afteredit: function(e){
var conn= new Ext.data.Connection();
conn.request({
url:'ttt.php',
params:{
id: e.record.indoor,
// ttt:e.record.price,
field: e.field,
value: e.value
},
success:function(resp,opt){
e.record.commit();
},
failure: function(resp,opt){
e.record.reject();
}
});
}
},
plugins: checkColumn,
width:600,
height:300,
frame:true,
title:'Framed with Checkbox Selection and Horizontal Scrolling',
iconCls:'icon-grid',
renderTo: document.body
});
}); |
Partager