caponet
17 Mar 2009, 5:21 AM
Hello,
I've just created a webpage, and all the components are created on a viewport:
Ext.onReady(function() {
var viewport = new Ext.Viewport(
{
layout : "border",
items : [ {
region : "center",
title : "Incidencies",
layout : "fit",
items : [ {
layout : "border",
items : [ {
region : "center",
title : "Dades de la Reclamacio"
}, {
region : "south",
title : "Resultats",
items : [ {
xtype : "grid",
border : false,
viewConfig : {
forceFit : true
},
ds : ds2,
cm : cm2
}],
height : 250
},
...
ds2 and cm2 are created previoulsy:
var cm_ttransporte = new Ext.grid.ColumnModel([
{header: "Targeta", width: 100, dataIndex: 'id'},
{header: "Nom", width: 120, dataIndex: 'nom'},
{header: "Llinatges", width: 180, dataIndex: 'llinatges'}
]);
cm_ttransporte.defaultSortable = true;
...
var ds2 = new Ext.data.Store({
// load using HTTP
proxy: new Ext.data.HttpProxy({url: 'CercaUsuari.xml'}),
// 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: 'id', mapping: 'usuari > id'},
{name: 'nom', mapping: 'usuari > nom'},
{name: 'llinatges', mapping: 'usuari > llinatges'}
])
});
I suppose that the xml data is not rendered into the grid because I haven't put something like
grid.render();
because I don't know how to reference my grid, as is not declared as a variable, I don't know how to access it (e.g: there's not a variable holding my grid).
So, how can I reference the components created via viewport+json?
Thanks in advance
I've just created a webpage, and all the components are created on a viewport:
Ext.onReady(function() {
var viewport = new Ext.Viewport(
{
layout : "border",
items : [ {
region : "center",
title : "Incidencies",
layout : "fit",
items : [ {
layout : "border",
items : [ {
region : "center",
title : "Dades de la Reclamacio"
}, {
region : "south",
title : "Resultats",
items : [ {
xtype : "grid",
border : false,
viewConfig : {
forceFit : true
},
ds : ds2,
cm : cm2
}],
height : 250
},
...
ds2 and cm2 are created previoulsy:
var cm_ttransporte = new Ext.grid.ColumnModel([
{header: "Targeta", width: 100, dataIndex: 'id'},
{header: "Nom", width: 120, dataIndex: 'nom'},
{header: "Llinatges", width: 180, dataIndex: 'llinatges'}
]);
cm_ttransporte.defaultSortable = true;
...
var ds2 = new Ext.data.Store({
// load using HTTP
proxy: new Ext.data.HttpProxy({url: 'CercaUsuari.xml'}),
// 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: 'id', mapping: 'usuari > id'},
{name: 'nom', mapping: 'usuari > nom'},
{name: 'llinatges', mapping: 'usuari > llinatges'}
])
});
I suppose that the xml data is not rendered into the grid because I haven't put something like
grid.render();
because I don't know how to reference my grid, as is not declared as a variable, I don't know how to access it (e.g: there's not a variable holding my grid).
So, how can I reference the components created via viewport+json?
Thanks in advance