Code:
Ext.onReady(function() {
Ext.state.Manager.setProvider(new Ext.state.CookieProvider({
expires: new Date(new Date().getTime()+(1000*60*60*24*7)), //7 days from now
}));
var store = new Ext.data.JsonStore({
// store configs
storeId: 'myStore',
autoLoad: true,
proxy: {
type: 'ajax',
loadMask: true,
url: 'read_form/getEmployee.php',
reader: {
type: 'json',
root: 'results',
idProperty: 'hoten'
}
},
//alternatively, a Ext.data.Model name can be given (see Ext.data.Store for an example)
fields: ['hoten','CoBan','ThoiVu','Khac','thunhapchiuthue','baohiem','npt','giamtru','thunhaptinhthue','thue','thueduocgiam','thuephainop','dakhautru']
});
var selModel = Ext.create('Ext.selection.CheckboxModel', {
listeners: {
selectionchange: function(sm, selections) {
grid.down('#removeButton').setDisabled(selections.length == 0);
}
}
});
// create the grid
var grid =Ext.create('Ext.grid.Panel', {
store: store,
columns: [
Ext.create('Ext.grid.RowNumberer'),
{ text: "H? tên", width: 60, dataIndex: 'hoten', locked : true, sortable: true, id: 'hoten' },
{ text: 'Thu nh?p ch?u thu?',
columns: [
{ text: "C? b?n", width: 60, dataIndex: 'CoBan', sortable: true,summaryType: 'sum' },
{ text: "Th?i v?", width: 60, dataIndex: 'ThoiVu', sortable: true ,summaryType: 'sum'},
{ text: "Khác", width: 60, dataIndex: 'Khac', sortable: true,summaryType: 'sum' },
{ text: "T?ng", width: 60, dataIndex: 'thunhapchiuthue', sortable: true ,summaryType: 'sum'}
]},
{ text: 'Gi?m tr?',
columns: [
{ text: "B?o hi?m", width: 60, dataIndex: 'baohiem', sortable: true },
{ text: "NPT", width: 60, dataIndex: 'npt', sortable: true },
{ text: "T?ng", width: 60, dataIndex: 'giamtru', sortable: true }]},
{ text: "Thu nh?p tính thu?", width: 100, dataIndex: 'thunhaptinhthue', sortable: true, id: 'thunhaptinhthue1' },
{ text: "Thu? phát sinh", width: 100, dataIndex: 'thue', sortable: true, id: 'thunhaptinhthue2' },
{ text: "Gi?m thu?", width: 70, dataIndex: 'thueduocgiam', sortable: true, id: 'thunhaptinhthue3' },
{ text: "Thu? ph?i kh?u tr?", width: 100, dataIndex: 'thuephainop', sortable: true },
],
columnLines: true,
selModel: selModel,
stateful: true,
stateId: 'stateGrid1',
// inline buttons
dockedItems: [{
xtype: 'toolbar',
items: [{
text:'Add Something',
tooltip:'Add a new row',
iconCls:'add'
},'-',{
itemId: 'removeButton',
text:'Remove Something',
tooltip:'Remove the selected item',
iconCls:'remove',
disabled: true
},
]
}],
renderTo: 'example-grid',
width: 680,
height: 200,
frame: true,
iconCls: 'icon-grid'
});
});
Thanks in advance......