PDA

View Full Version : combobox dynamic data



DetBerlin
23 Nov 2012, 9:01 AM
boah......
slowly it is really hard to work with extjs.


problem of problem.......


So I would like the following combobox dynamically pass data which must be computed because they are not fixed yet. For example one customer buys a pizza for 5 euro or dollar he gets but the opportunity to redeem a faithful bonus now be calculated how much the bonus is the use he can. and this income will I need in the combobox

DetBerlin
23 Nov 2012, 1:41 PM
{
xtype:'combobox',
id:'regFeld10',
fieldLabel:'Punkte' ,
labelWidth:71,
width:147,
allowBlank:false,
editable:false,
queryMode:'local',
store:kassDataArray,
valueField:'pnk',
displayField:'pnk',
x:8,
y:192
},



store: kassDataArray

soll mit daten gefüllt werden in etwa so......

var variable = (betrag - minsum) / 0.5
for (var i = 0; i <= variable ; i++) {kassDataArray[i] =i};

"betrag und minsum sind variablen die aus der hompage befüllt werden
nur warum geht das nicht

und vorallem wo kommt die schleife hin?

Farish
23 Nov 2012, 3:10 PM
var kassDataStore = Ext.create('Ext.data.Store', {
fields: ['pnk']
});

Ext.create('Ext.form.ComboBox', {
id:'regFeld10',
fieldLabel:'Punkte',
labelWidth:71,
width:147,
allowBlank:false,
editable:false,
queryMode:'local',
store: kassDataStore, // das hier muss ein Ext Store Objekt sein
valueField:'pnk',
displayField:'pnk'
});

var variable = (betrag - minsum) / 0.5;
kassDataArray.length = 0; // reset array length to 0
for (var i = 0; i <= variable ; i++)
kassDataArray.push({'pnk':i});

kassDataStore.loadData(kassDataArray);

DetBerlin
24 Nov 2012, 12:40 AM
var kassDataStore = Ext.create('Ext.data.Store', {
fields: ['pnk']
});

Ext.create('Ext.form.ComboBox', {
id:'regFeld10',
fieldLabel:'Punkte',
labelWidth:71,
width:147,
allowBlank:false,
editable:false,
queryMode:'local',
store: kassDataStore, // das hier muss ein Ext Store Objekt sein
valueField:'pnk',
displayField:'pnk'
});

var variable = (betrag - minsum) / 0.5;
kassDataArray.length = 0; // reset array length to 0
for (var i = 0; i <= variable ; i++)
kassDataArray.push({'pnk':i});

kassDataStore.loadData(kassDataArray);


du hast vergessen das Array zu definieren.
var kassDataArray = []

aber sonst functioniert alles prima...

Danke Farish