PDA

View Full Version : get total from Ext.data. HttpProxy



nelmoulaoui
23 Nov 2010, 5:07 AM
How from Ext.data. HttpProxy I can get back the number of resulted sent back(dismissed) by the requete ajax.

any ideas ?

Condor
23 Nov 2010, 5:16 AM
You don't usually use a HttpProxy stand alone.

You either use a store (use the callback method or the load event) or an Ext.Ajax.request (use the success method).

nelmoulaoui
23 Nov 2010, 5:40 AM
think you for your response. but i have always a problem :

var ds = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url: 'myFile.xml'}),

reader: new Ext.data.XmlReader({
record: 'Event'
}, [
{name: 'Author', mapping: 'Author'}, 'EventName', 'Rating'
]
)
});


ds.load({callback: function()
{
ds.each(function(record)
{
alert(record.data['EventName']);
});
}
});

It does not work !!!

nelmoulaoui
23 Nov 2010, 5:42 AM
think you for your response, but i have always a problem :
var ds = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url: 'events.xml'}),

reader: new Ext.data.XmlReader({
record: 'Event'
}, [
{name: 'Author', mapping: 'Author'}, 'EventName', 'Rating'
]
)
});


ds.load({callback: function()
{
ds.each(function(record)
{
alert(record.data['EventName']);
});
}
});

It does not work

nelmoulaoui
23 Nov 2010, 5:43 AM
think you for your response, but i have always a problem :
var ds = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url: 'events.xml'}),

reader: new Ext.data.XmlReader({
record: 'Event'
}, [
{name: 'Author', mapping: 'Author'}, 'EventName', 'Rating'
]
)
});


ds.load({callback: function()
{
ds.each(function(record)
{
alert(record.data['EventName']);
});
}
});

It does not work

Condor
24 Nov 2010, 2:39 AM
Should work.

1. Are you sure events.xml is accessible?
2. Does the data in events.xml match the configured reader?

ps. This doesn't work on the local filesystem. You need a HTTP server!