Hi Guys,
No need to say that im new using EXTJS (first post
).
Im having issues getting this example: http://www.foscode.com/populate-extjs-mysql-datastore/ to work. I Did the PHP page (myDBConnection.php) and, if i run it alone on the page, i get this result from my DB table :
{"myInventory":[{"nome":"Joao Silva da Souza de Almeida"},{"nome":"Maria Alvarenga"},{"nome":"Silvia Santos"},{"nome":"Fernando Fernandes"},{"nome":"Joaquina de Abreu"}],"totalCount":5}
Is that correct?
Assumig it is a good-to-go result, i did the next step that was using this on the js file. It is like this:
Code:
Ext.onReady(function(){
var ds = new Ext.data.GroupingStore({
proxy: new Ext.data.HttpProxy({
url:'myDBConnection.php'
}),
reader: new Ext.data.JsonReader({
id: 'Completion_ID', // no need to change it right?
totalProperty: 'totalCount',
root: "myInventory",
fields:
[{name: 'name', type: 'string', mapping: 'name'}] //only getting the name to see if it works
})
});
var mycolModel = new Ext.grid.ColumnModel({
columns: [
{header: 'name', width:70, dataIndex: 'name'}
]
});
// trigger the data store load
ds.load({params:{start:0, limit:1000}});
//Now our grid
var grid = new Ext.grid.EditorGridPanel({
store: ds ,
stripeRows: true,
width: 630,
height:315,
autoSizeGrid: false,
title:'PM Status (Current Quarter)',
collapsible: false,
animCollapse: false
cm: mycolModel,
selModel: new Ext.grid.RowSelectionModel(),
viewConfig: {
forceFit: true
}
});
grid.render('grid-example');
};
Whats is wrong with this scenario? i just then insert this name on the div at the HTML and it does not get anything back.
Hoping you guys can help me.
Thanks!