PDA

View Full Version : Ext.Data.Store problem



milanche
24 Sep 2009, 5:28 AM
Hi.
I have a situation and a problem...
Situantion is:
i have modal window and form in it.
form have 2-3 comboboxses and some more stuff.

Now, i want to click on a button,
getValues of comboBoxses,
load some Ext.Data.Store,
get those values from store,
open new modal window,
and use that data from store...

problem is. i dont'n know how to read data from store.

my store look like this:

var ds_uput_info = new Ext.data.Store(
{
proxy: new Ext.data.HttpProxy(
{
url: 'application/editori/ob_15/json/uput_info.php?zap_id=0&rms=0'
}
),
reader: new Ext.data.JsonReader(
{
totalProperty: 'ukupnoPodataka',
root: 'uputPodaci'
},
[
{name: 'ui_ime', mapping: 'ui_ime'},
{name: 'ui_prezime', mapping: 'ui_prezime'}
]
)
});here is my button:


var dugme_uput = new Ext.Button({
text:'Uput',
x:60,
y:160,
width:150,
handler: function() {

rms = komboRm.getValue();
zap_id = komboLica.getValue();
ds_uput_info.proxy.url = 'application/editori/ob_15/json/uput_info.php?rms='+rms+'&zap_id='+zap_id;
//alert(ds_uput_info.proxy.url);
ds_uput_info.load({callback: function(r,options,success)
{
//????????????
}
});
}

});
you can see the way i'm setting url params for json... i haven't seen this method ever, but it is only way my store works...

and, my json look like this:



{"ukupnoPodataka":"1","uputPodaci":[{"ui_ime":"some name","ui_prezime":"some stuff"}]}
PHP is making this json output, and it allways returns 1 dataset.

My english is not so good, variables are serbian words, but i hope that someone will help me...

So the question is:
i'm using funny way to set the proxy.url params, is there a better one?
i can't make my code to read store and json, can anyone?

:)

8 Oct 2009, 7:15 AM
var ds_uput_info = new Ext.data.Store(
{
proxy: new Ext.data.HttpProxy(
{
url: 'application/editori/ob_15/json/uput_info.php' //'?zap_id=0&rms=0'
}
),
reader: new Ext.data.JsonReader(
{
totalProperty: 'ukupnoPodataka',
root: 'uputPodaci'
},
[
{name: 'ui_ime', mapping: 'ui_ime'},
{name: 'ui_prezime', mapping: 'ui_prezime'}
]
)
});


then...


var dugme_uput = new Ext.Button({
text:'Uput',
x:60,
y:160,
width:150,
handler: function() {

rms = komboRm.getValue();
zap_id = komboLica.getValue();
// ds_uput_info.proxy.url = 'application/editori/ob_15/json/uput_info.php?rms='+rms+'&zap_id='+zap_id;
//alert(ds_uput_info.proxy.url);
ds_uput_info.load({
//url : '', // optional
params : {
rms : rms,
zap_id : zap_id
},
callback: function(r,options,success)
{
//????????????
}
});
}

});