欢迎您访问我爱IT技术网,今天小编为你分享的javascript教程:【ExtJs扩展之GroupPropertyGrid代码】,下面是详细的讲解!
ExtJs扩展之GroupPropertyGrid代码
Ext.ux.grid.GroupPropertyStore=function(grid, source){
this.grid=grid;
this.store=new Ext.data.GroupingStore({
recordType : Ext.ux.grid.GroupPropertyRecord,
groupField : "group"
});
this.store.on('update', this.onUpdate, this);
if(source){
this.setSource(source);
}
Ext.ux.grid.GroupPropertyStore.superclass.constructor.call(this);
};
Ext.extend(Ext.ux.grid.GroupPropertyStore, Ext.util.Observable, {
setSource : function(o){
this.source=o;
this.store.removeAll();
var data=[];
for(var k in o){
if(this.isEditableValue(o[k])){
data.push(new Ext.ux.grid.GroupPropertyRecord({name: k, value: o[k],group:k},k));
}
else if(typeof(o[k])=='object'){
for(var n in o[k]){
data.push(new Ext.ux.grid.GroupPropertyRecord({name: n, value: o[k][n],group:k},k+"&&"+n));
}
}
}
this.store.loadRecords({records: data}, {}, true);
},
// private
onUpdate : function(ds, record, type){
if(type==Ext.data.Record.EDIT){
var v=record.data['value'];
var oldValue=record.modified['value'];
if(this.grid.fireEvent('beforepropertychange', this.source, record.id, v, oldValue) !==false){
if(record.id.indexOf("&&")!=-1)
{
var values=record.id.split("&&");
this.source[values[0]][values[1]]=v;
}
else
{
this.source[record.id]=v;
}
record.commit();
this.grid.fireEvent('propertychange', this.source, record.id, v, oldValue);
}else{
record.reject();
}
}
},
// private
getProperty : function(row){
return this.store.getAt(row);
},
// private
isEditableValue: function(val){
if(Ext.isDate(val)){
return true;
}else if(typeof val=='object' || typeof val=='function'){
return false;
}
return true;
},
// private
setValue : function(prop, value){
this.source[prop]=value;
this.store.getById(prop).set('value', value);
},
// protected - should only be called by the grid. Use grid.getSource instead.
getSource : function(){
return this.source;
}
});
关于ExtJs扩展之GroupPropertyGrid代码的用户互动如下:
相关问题:extjs PropertyGrid该组件实现某行不可编辑,别的...
答:对某行的列设定 readOnly属性呢? >>详细
相关问题:extjs属性表格PropertyGrid使用
答:Ext.onReady(function(){Ext.create("Ext.grid.property.Grid",{title:"MyPropertyGrid",width:400,renderTo:Ext.getBody(),source:{"name":"Crossci","Created": Ext.Date.parse('2012-05-15', 'Y-m-d'),"available":true,"age":19,"desc":"goo... >>详细
相关问题:Extjs 之 initComponent 和 constructor的区别
答:Extjs 提供的组件还是挺丰富的, 但是有时候需求更丰富。 当Extjs 原生的组件无法实现我们的要求的时候, 就需要扩展Extjs 的组件实现自制组件了。 除了这种使用状况, 有时候对于一些相同却有使用很多的配置, 可能像把它独立出来,单独设为一... >>详细
- 【firefox】firefox浏览器不支持innerText的解决
- 【Extjs】Extjs学习过程中新手容易碰到的低级错误
- 【clearInterval】js clearInterval()方法的定义
- 【dom】javascript dom追加内容实现示例-追加内容
- 【checkbox】让checkbox不选中即将选中的checkbox
- 【Array】js中更短的 Array 类型转换-类型转换
- 【append】append和appendTo的区别以及appendChil
- 【ExtJs】ExtJs 表单提交登陆实现代码-表单提交-
- 【addClass】javascript自定义的addClass()方法
- 【Event】jquery下为Event handler传递动态参数的
- 评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)
-
