PDA

View Full Version : problem with getting data into triggerfiled



Dannesart
30 Nov 2011, 5:55 AM
Hi! I got a triggerfiled


{
xtype: 'triggerfield',
height: 30,
fieldLabel: 'Orsak',
itemId: 'reason',
disabled: true
},
My loader:

loadLostCodesList: function() {
var query = Ext.create('Intelliplan.Data.General.CustOrder.Query.LostCodesList');
query.execute(function() {
}, this);
},

Model:

Ext.define('Intelliplan.Data.General.CustOrder.Query.LostCodesList', {
extend: 'Intelliplan.Base.Data.Query',
proxy: Ext.create('Intelliplan.Base.Proxy.Standard', {
url: Intelliplan.Api.BaseUrl + '/General/CustOrder/GetLostCodesList'
}),
fields: [
{ name: 'messageKey', type: 'int' },
{ name: 'name', type: 'string' }

]
});

Need Help!Thank you!

tobiu
30 Nov 2011, 5:59 AM
a TriggerField is just a textfield with a trigger button.
if you want to use a store, you are probably looking for:

http://docs.sencha.com/ext-js/4-0/#!/api/Ext.form.field.ComboBox

Dannesart
30 Nov 2011, 6:36 AM
Okay. And How to get the data into the combobox?
I use:
defineStore: function() {
return Ext.create('Intelliplan.Base.Store.Standard',{
model: 'Intelliplan.Data.General.CustOrder.Query.LostCodesList'

})
},

Dannesart
1 Dec 2011, 1:18 AM
In my dialog.js

{
xtype: 'combobox',
height: 30,
fieldLabel: 'Orsak',
itemId: 'reason',
displayField: 'name',
valueField: 'messageKey',
queryMode: 'local',
disabled: true,

emptyText: 'Välj orsak',
displayField: 'name',
valueField: 'messageKey'
},


Ext.define('Intelliplan.Data.General.CustOrder.Query.LostCodesList', {
extend: 'Intelliplan.Base.Data.Query',
proxy: Ext.create('Intelliplan.Base.Proxy.Standard', {
url: Intelliplan.Api.BaseUrl + '/General/CustOrder/GetLostCodesList'
}),
fields: [
{ name: 'messageKey', type: 'int' },
{ name: 'name', type: 'string' }

]
});
In my DialogUi.js which is extended in my dialog.js

loadLostCodesList: function(custOrderNo) {
var query = Ext.create('Intelliplan.Data.General.CustOrder.Query.LostCodesList');
query.execute(function() {
}, this);
},

:/ can't get it work

tvanzoelen
1 Dec 2011, 6:36 AM
It is difficult to see what you are doing with all these extends. But it works in principle the same as you define a store, model, proxy and reader on a grid.

In that case your Combobox must contain a store property. I do not see that property in your case.

Dannesart
1 Dec 2011, 6:41 AM
Problem solved, made a new combobox class:

Ext.define('Intelliplan.Modules.Staffing.CurrentCustOrders.LostCodeCombobox', {
extend: 'Intelliplan.Base.ComboBox.Standard',
alias: 'widget.modules.currentcustorders.combobox',
initComponent: function () {

Ext.apply(this, {
height: 30,
fieldLabel: 'Orsak',
displayField: 'name',
valueField: 'messageKey',
disabled: true,
emptyText: 'Välj orsak',
queryMode: 'local',
triggerAction: 'all',
editable: false,
forceSelection: true,
defaultListConfig: {
loadMask: false //due to a suspected bug in ext js load mask is disabled. Otherwise loadmask will appear after each reload of store.
}
});

this.callParent(arguments);

//add handlers
this.on('select', this.onSelectEvent, this);

},
defineStore: function() {
return Ext.create('Intelliplan.Base.Store.Standard', {
model: 'Intelliplan.Data.General.CustOrder.Query.LostCodesList'
});
},
loadStore: function() {
this.store.load();
},
onSelectEvent: function(picker, records, options) {
this.selectedKey = records[0].getId();
}
});

and then xtype:'modules.currentcustorders.combobox'

Thank you!