Browse Source

pass pk and api to the combo instead of getting it from the form

Natenom/support-murmur-13-1446181288462
Michael Ziegler 12 years ago
parent
commit
62b89a610d
  1. 22
      pyweb/djextdirect/formprovider.py

22
pyweb/djextdirect/formprovider.py

@ -60,6 +60,13 @@ Ext.ux.%(clsname)s = function( config ){
this.api = %(apiconf)s;
for( var i = 0; i < this.items.length; i++ ){
if( this.items[i].xtype == "choicescombo" ){
this.items[i].pk = config.pk;
this.items[i].api = this.api;
}
}
Ext.ux.%(clsname)s.superclass.constructor.call( this );
this.form.api = this.api;
@ -126,25 +133,26 @@ Ext.ux.ChoicesCombo = function( config ){
});
this.triggerAction = 'all';
this.store = new Ext.data.DirectStore({
baseParams: {'pk': this.ownerCt.pk, 'field': this.name},
directFn: this.ownerCt.api.choices,
baseParams: {'pk': this.pk, 'field': this.name},
directFn: this.api.choices,
paramOrder: ['pk', 'field'],
reader: new Ext.data.JsonReader({
successProperty: 'success',
idProperty: this.valueField,
root: 'data',
fields: [this.valueField, this.displayField]
}),
autoLoad: true
});
})
});
Ext.ux.ChoicesCombo.superclass.constructor.call( this );
};
this.store.load();
};
Ext.extend( Ext.ux.ChoicesCombo, Ext.form.ComboBox, {
});
});
Ext.reg( 'choicescombo', Ext.ux.ChoicesCombo );
"""

Loading…
Cancel
Save