javascripts/basepack.js in netzke-basepack-0.7.6 vs javascripts/basepack.js in netzke-basepack-0.7.7
- old
+ new
@@ -20,22 +20,28 @@
// ComboBox that gets options from the server (used in both grids and panels)
Ext.define('Ext.netzke.ComboBox', {
extend : 'Ext.form.field.ComboBox',
alias : 'widget.netzkeremotecombo',
- valueField : 'field1',
- displayField : 'field2',
+ valueField : 'value',
+ displayField : 'text',
triggerAction : 'all',
// WIP: Breaking - should not be 'true' if combobox is not editable
// typeAhead : true,
+ // getDisplayValue: function() {
+ // return this.getValue() == 0 ? this.emptyText : this.callOverridden();
+ // },
+
initComponent : function(){
var modelName = this.parentId + "_" + this.name;
+ if (this.blankLine == undefined) this.blankLine = "---";
+
Ext.define(modelName, {
extend: 'Ext.data.Model',
- fields: ['field1', 'field2']
+ fields: ['value', 'text']
});
var store = new Ext.data.Store({
model: modelName,
proxy: {
@@ -46,27 +52,30 @@
root: 'data'
}
}
});
- // TODO: find a cleaner way to pass this.name to the server
store.on('beforeload', function(self, params) {
params.params.column = this.name;
},this);
+ // insert a selectable "blank line" which allows to remove the associated record
+ if (this.blankLine) {
+ store.on('load', function(self, params) {
+ // append a selectable "empty line" which will allow remove the association
+ self.add(Ext.create(modelName, {value: -1, text: this.blankLine}));
+ }, this);
+ }
+
// If inline data was passed (TODO: is this actually working?)
if (this.store) store.loadData({data: this.store});
this.store = store;
this.callParent();
},
- collapse: function(){
- // HACK: do not hide dropdown menu while loading items
- if( !this.store.loading ) this.callParent();
- }
});
Ext.util.Format.mask = function(v){
return "********";
};
@@ -129,20 +138,7 @@
// TODO: maybe we should simply initialize 'uncheckedValue' somewhere else,
// instead
Ext.override( Ext.form.field.Checkbox, {
getSubmitValue: function() {
return this.callOverridden() || false; // 'off';
- }
-});
-
-/* We were missing the 'load' event on proxy, implementing it ourselves */
-Ext.override(Ext.data.proxy.Server, {
- constructor: function() {
- this.addEvents('load');
- this.callOverridden([arguments]);
- },
-
- processResponse: function(success, operation, request, response, callback, scope){
- this.callOverridden(arguments);
- this.fireEvent('load', this, response, operation);
}
});