PDA

View Full Version : [SOLVED]Values from DB doesn't show in my fields.



Czapla
15 Feb 2010, 12:40 AM
Hello

After clicking edit button on some items my values from DB dosn't show up in my fields.
My firebug returns the query :


({"results":[{"0":"rrr","srt_nazwa":"rrr","1":"rrrr","srt_kod":"rrrr"}]})

Here is my function in my button


handler: function() {
var wybierz_rekord = wyswietl_srodki.getSelectionModel().getSelected();
if (wybierz_rekord) {
srodek_ogolne.getForm().load({url:'warstwy/logika/edytuj_srodek.php?akcja=edytuj&srt_srtid='+ wybierz_rekord.get('srt_srtid')});
okno_modal.show();
}
else { return false }
}
}

Function is returning id of element in my grid and open a new modal window


var okno_modal = new Ext.Window({
title: 'Dodaj \u015arodek',
border: false,
width: '800',
height: '650',
defaults:{autoHeight: true},
modal: true,
closeAction:'hide',
layout: 'fit',
items: [{
xtype: 'tabpanel',
activeTab: 0,
border: false,
bodyStyle:'padding:5px 5px 5px 5px; background-color:transparent;',
width: '100%',
height: '100%',
defaults:{autoHeight: true},
autoTabs: true,
items:[srodek_ogolne, srodek_amortyzacja, srodek_dodatkowe]
}]

Here is my panel


var srodek_ogolne = new Ext.FormPanel ({
url: 'warstwy/logika/edytuj_srodek.php?akcja=edytuj',
title: 'Informacje podstawowe',
bodyStyle:'padding:5px 5px 5px 5px; background-color:transparent;',
items: [{
xtype: 'fieldset',
title: 'Rodzaj',
autowidth: true,
items: [{
xtype: 'textfield',
fieldLabel: 'Nazwa',
id: 'srt_nazwa',
name: 'srt_nazwa',
allowBlank:false,
anchor: '100%'
},{
xtype: 'textfield',
fieldLabel: 'Kod',
id: 'srt_kod',
name: 'srt_kod',
allowBlank:false,
anchor: '100%'
}


Added


reader: new Ext.data.JsonReader ({
root: 'results',
fields: ['srt_srtid','srt_nazwa','srt_kod']
}),


It's working