日期:2014-05-16  浏览次数:20301 次

能帮我注释一下 下面的JS代码吗 尽量多的注释 因为JS我们没学过 所有不懂
[{ xtype : 'grid',
store : Ext.create('Ext.data.Store', {
storeId : 'userStore',
autoLoad : true,
fields : [ 'id', 'name', 'address', 
    {
name:'role',
convert:function(v, record){
     return record.raw.role.name;
}
}, 'phone','sex', 'birthday' ],
proxy : {
type : 'ajax',
url : 'user/user!getUserListByName.action',
extraParams:{
'user.name' :'_'
},
reader : {
type : 'json',
root : 'result'
}
}
}),
columns : [{
header : 'ID',
dataIndex : 'id',
},
{
header : '名称',
dataIndex : 'name',
editor : {
xtype : 'textfield',
allowBlank : false
}
},
{
header : '性别',
dataIndex : 'sex',
renderer:function(val,meta,rec){
if(rec.data.sex)
return '男';
else
return '女';
},
editor : {
xtype : 'combo',
store : Ext.create('Ext.data.Store', {
fields : ['name', 'value'],
data : [{
"value" : false,
"name" : "女"
}, {
"value" : true,
"name" : "男"
}]
}),
queryMode : 'local',
displayField : 'name',
valueField : 'value',
allowBlank : false
}
},
{
header : '出生日期',
dataIndex : 'birthday',
editor : {
xtype : 'datefield',
format:'Y-m-d',
allowBlank : false
}
},
{
header : '角色',
dataIndex : 'role'
},{
header : '电话号码',
flex : 1,
editor : {
xtype : 'textfield',
allowBlank : false
},
dataIndex : 'phone'
}, 
{
header : '联系地址',
flex : 1,
editor : {
xtype : 'textfield',
allowBlank : false
},
dataIndex : 'address'
}, {
xtype : 'actioncolumn',
width : 50,
items : [{
icon : 'icons/18.gif',
tooltip : '删除',
handler : function(grid, rowIndex, colIndex) {
var rec = grid.getStore().getAt(rowIndex);
Ext.Msg
.confirm(
"删除",
"确定要删除?",
function(re) {
if (re == 'yes') {
Ext.Ajax.request({
url : 'user/user!delUser.action',
params : {
'user.id' : rec
.get('id')
},
success : function(
response) {
Ext.Msg
.alert(Ext
.decode(response.responseText).msg);
var name = Ext.getCmp('uName').getValue();