Alien-Web-ExtJS-V3
view release on metacpan or search on metacpan
share/pkgs/pkg-grid-property-debug.js view on Meta::CPAN
}else{
record.reject();
}
}
},
// private
getProperty : function(row){
return this.store.getAt(row);
},
// private
isEditableValue: function(val){
return Ext.isPrimitive(val) || Ext.isDate(val);
},
// private
setValue : function(prop, value, create){
var r = this.getRec(prop);
if(r){
r.set('value', value);
this.source[prop] = value;
}else if(create){
// only create if specified.
this.source[prop] = value;
r = new Ext.grid.PropertyRecord({name: prop, value: value}, prop);
this.store.add(r);
}
},
// private
remove : function(prop){
var r = this.getRec(prop);
if(r){
this.store.remove(r);
delete this.source[prop];
}
},
// private
getRec : function(prop){
return this.store.getById(prop);
},
// protected - should only be called by the grid. Use grid.getSource instead.
getSource : function(){
return this.source;
}
});
/**
* @class Ext.grid.PropertyColumnModel
* @extends Ext.grid.ColumnModel
* A custom column model for the {@link Ext.grid.PropertyGrid}. Generally it should not need to be used directly.
* @constructor
* @param {Ext.grid.Grid} grid The grid this store will be bound to
* @param {Object} source The source data config object
*/
Ext.grid.PropertyColumnModel = Ext.extend(Ext.grid.ColumnModel, {
// private - strings used for locale support
nameText : 'Name',
valueText : 'Value',
dateFormat : 'm/j/Y',
trueText: 'true',
falseText: 'false',
constructor : function(grid, store){
var g = Ext.grid,
f = Ext.form;
this.grid = grid;
g.PropertyColumnModel.superclass.constructor.call(this, [
{header: this.nameText, width:50, sortable: true, dataIndex:'name', id: 'name', menuDisabled:true},
{header: this.valueText, width:50, resizable:false, dataIndex: 'value', id: 'value', menuDisabled:true}
]);
this.store = store;
var bfield = new f.Field({
autoCreate: {tag: 'select', children: [
{tag: 'option', value: 'true', html: this.trueText},
{tag: 'option', value: 'false', html: this.falseText}
]},
getValue : function(){
return this.el.dom.value == 'true';
}
});
this.editors = {
'date' : new g.GridEditor(new f.DateField({selectOnFocus:true})),
'string' : new g.GridEditor(new f.TextField({selectOnFocus:true})),
'number' : new g.GridEditor(new f.NumberField({selectOnFocus:true, style:'text-align:left;'})),
'boolean' : new g.GridEditor(bfield, {
autoSize: 'both'
})
};
this.renderCellDelegate = this.renderCell.createDelegate(this);
this.renderPropDelegate = this.renderProp.createDelegate(this);
},
// private
renderDate : function(dateVal){
return dateVal.dateFormat(this.dateFormat);
},
// private
renderBool : function(bVal){
return this[bVal ? 'trueText' : 'falseText'];
},
// private
isCellEditable : function(colIndex, rowIndex){
return colIndex == 1;
},
// private
getRenderer : function(col){
return col == 1 ?
this.renderCellDelegate : this.renderPropDelegate;
},
// private
( run in 0.810 second using v1.01-cache-2.11-cpan-ceb78f64989 )