PDA

View Full Version : GridPanel with xmlstore and PagingToolbar



diegouc
15 Feb 2010, 10:01 AM
Hi, I have this code


Ext.onReady(function(){

var store = new Ext.data.XmlStore({

proxy: new Ext.data.HttpProxy({
url: 'http://localhost/TestUserControlYUI.NetEnvironment/sheldon.xml'
}),

record: 'Item', // records will have an "Item" tag

id: 'ASIN',
totalRecords: '@total',
remoteSort: true,

fields: [
// 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 grid = new Ext.grid.GridPanel({
width:700,
height:500,
title:'ExtJS.com - Browse Forums',
store: store,
trackMouseOver:false,
disableSelection:true,
loadMask: true,

columns: [
{header: "Author", width: 120, dataIndex: 'Author', sortable: true},
{header: "Title", width: 180, dataIndex: 'Title', sortable: true},
{header: "Manufacturer", width: 115, dataIndex: 'Manufacturer', sortable: true},
{header: "Product Group", width: 100, dataIndex: 'ProductGroup', sortable: true}
],




// paging bar on the bottom
bbar: new Ext.PagingToolbar({
pageSize: 5,
store: store,
displayInfo: true



})
});

// render it
grid.render('topic-grid');


store.load({params:{start:0, limit:5}});
});
The problem is that not show nothing but i don't know why
Tranks for help me.

fay
15 Feb 2010, 10:12 AM
Add a loadException handler for your store. Also use FireFox + FireBug.

diegouc
15 Feb 2010, 10:22 AM
How Add a loadException?
Sorry i new in extjs

fay
15 Feb 2010, 10:25 AM
I'd suggest some smaller simpler steps then before jumping into it :)

Definitely get yourself set up with FireFox + FireBug - indispensible for development/debugging, and start with http://www.extjs.com/learn/Main_Page

For this particular problem see: http://www.extjs.com/learn/Ext_FAQ_Grid#Store_appears_empty_even_after_calling_load.28.29

bclinton
15 Feb 2010, 10:32 AM
How Add a loadException?
Sorry i new in extjs

There is an exception event in the XmlStore class:
http://www.extjs.com/deploy/dev/docs/?class=Ext.data.XmlStore#event-Ext.data.Store-exception?class=Ext.data.XmlStore

so, do something like this:


store.on('exception', function(proxy, type, action, options, response, arg) {
console.log('I am seeing this message in my console because I installed Firebug!');
});

diegouc
15 Feb 2010, 10:40 AM
Now add this line method : 'GET' in the HttpProxy
and load all record but not is paging

fay
15 Feb 2010, 10:48 AM
You really need to read the FAQs (http://www.extjs.com/learn/Ext_FAQ_Grid#Paging.2C_Paging_toolbar.2C_Total_record_count).