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 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
| /*!
* Ext JS Library 4.0
* Copyright(c) 2006-2011 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
Ext.define('MyDesktop.GridWindow', {
extend: 'Ext.ux.desktop.Module',
requires: [
'Ext.data.ArrayStore',
'Ext.util.Format',
'Ext.grid.Panel',
'Ext.grid.RowNumberer'
],
id:'grid-win',
init : function(){
this.launcher = {
text: 'Bots Status',
iconCls:'icon-grid'
};
},
createWindow : function(){
var desktop = this.app.getDesktop();
var win = desktop.getWindow('grid-win');
if(!win){
win = desktop.createWindow({
id: 'grid-win',
title:'Bots Status',
width:740,
height:480,
iconCls: 'icon-grid',
animCollapse:false,
constrainHeader:true,
layout: 'fit',
items: [
{
border: false,
xtype: 'grid',
selModel: Ext.create('Ext.selection.CheckboxModel'),
store: new Ext.data.ArrayStore({
fields: [
{ name: 'username' },
{ name: 'password' },
{ name: 'status', type: 'float' }
],
data: MyDesktop.GridWindow.getBots()
}),
columns: [
new Ext.grid.RowNumberer(),
{
text: "Username",
flex: 1,
sortable: true,
dataIndex: 'username'
},
{
text: "Password",
width: 70,
dataIndex: 'password'
},
{
text: "Status",
width: 70,
sortable: true,
dataIndex: 'status'
}
]
}
],
tbar:[{
text:'Add',
tooltip:'Add a new bot',
iconCls:'add'
}, '-', {
text:'Check',
tooltip:'Modify options',
iconCls:'option',
handler: function() {
alert('ok');
}
},'-',{
text:'Remove',
tooltip:'Remove the selected bots',
iconCls:'remove'
}]
});
}
return win;
},
statics: {
getBots: function () {
$.ajax({
url : 'includes/botsStatus.php',
dataType: "json",
beforeSend: function(x) {
if(x && x.overrideMimeType) {
x.overrideMimeType("application/json;charset=UTF-8");
}
},
success :
function(data) {
return data;
},
error :
function (data) {
alert('erreur ' + data);
}
});
}
}
}); |
Partager