bjeenie
14 Jun 2007, 6:29 AM
hello,
i inserted ext-all.js to my webpage.
and i also hava a values.js javascript file where i get a list of values (output in XML) through AJAX.
so i have a xml-request.
I've seen in the demo's of ext that you can make a grid with an XML that you get from AJAX.
when i take a look at the demo i don't get how it has to work.
i have this javascript code:
function getResults()
{
var pars = 'actie=getResults&Persnr=' + strPersnr;
var myAjax = new Ajax.Request(
url,
{
method: 'post',
postBody: pars,
onComplete: setResults
});
}
function setResults(originalRequest)
{
// create the Data Store
var ds = new Ext.data.Store({
// load using HTTP
proxy: new Ext.data.HttpProxy({originalRequest})
// the return will be XML, so lets set up a reader
reader: new Ext.data.XmlReader({
// records will have an "Item" tag
record: 'Item',
id: 'ASIN',
totalRecords: '@total'
}, [
// set up the fields mapping into the xml doc
// The first needs mapping, the others are very basic
{name: 'Author', mapping: 'ItemAttributes > Author'},
'Title', 'Manufacturer', 'ProductGroup'
])
});
var cm = new Ext.grid.ColumnModel([
{header: "Author", width: 120, dataIndex: 'naam'},
{header: "Title", width: 180, dataIndex: 'testnaam'},
{header: "Manufacturer", width: 115, dataIndex: 'score'},
{header: "Product Group", width: 100, dataIndex: 'datum'},
{header: "Product Group", width: 100, dataIndex: 'uur'}
]);
cm.defaultSortable = true;
// create the grid
var grid = new Ext.grid.Grid('example-grid', {
ds: ds,
cm: cm
});
grid.render();
ds.load();
}
but it gives this faults:
line 65: ":" is expected -->proxy: new Ext.data.HttpProxy({originalRequest})
line 10: "Ext" is not defined
line 34: object is expected.
What do i do wrong?
kind regards.
thomas
i inserted ext-all.js to my webpage.
and i also hava a values.js javascript file where i get a list of values (output in XML) through AJAX.
so i have a xml-request.
I've seen in the demo's of ext that you can make a grid with an XML that you get from AJAX.
when i take a look at the demo i don't get how it has to work.
i have this javascript code:
function getResults()
{
var pars = 'actie=getResults&Persnr=' + strPersnr;
var myAjax = new Ajax.Request(
url,
{
method: 'post',
postBody: pars,
onComplete: setResults
});
}
function setResults(originalRequest)
{
// create the Data Store
var ds = new Ext.data.Store({
// load using HTTP
proxy: new Ext.data.HttpProxy({originalRequest})
// the return will be XML, so lets set up a reader
reader: new Ext.data.XmlReader({
// records will have an "Item" tag
record: 'Item',
id: 'ASIN',
totalRecords: '@total'
}, [
// set up the fields mapping into the xml doc
// The first needs mapping, the others are very basic
{name: 'Author', mapping: 'ItemAttributes > Author'},
'Title', 'Manufacturer', 'ProductGroup'
])
});
var cm = new Ext.grid.ColumnModel([
{header: "Author", width: 120, dataIndex: 'naam'},
{header: "Title", width: 180, dataIndex: 'testnaam'},
{header: "Manufacturer", width: 115, dataIndex: 'score'},
{header: "Product Group", width: 100, dataIndex: 'datum'},
{header: "Product Group", width: 100, dataIndex: 'uur'}
]);
cm.defaultSortable = true;
// create the grid
var grid = new Ext.grid.Grid('example-grid', {
ds: ds,
cm: cm
});
grid.render();
ds.load();
}
but it gives this faults:
line 65: ":" is expected -->proxy: new Ext.data.HttpProxy({originalRequest})
line 10: "Ext" is not defined
line 34: object is expected.
What do i do wrong?
kind regards.
thomas