PDA

View Full Version : Problems updating example's index to usw SQL backend, need help.



asterix
22 Feb 2011, 6:03 AM
Hi,

want to modify Example's mainpage fo be SQL-Backed (for having a nice base for a tutorial)

i changed store JsonStore to use data from SQL


var store = new Ext.data.JsonStore({
idProperty : 'id',
fields : ['id', 'title', 'samples'],
data : catalog
});

to


var fields = new Ext.data.Record.create([
{name: 'idCategory'},
{name: 'Category'},
{name: 'Screens'}
]);
var store = new Ext.data.JsonStore({
storeID : 'store',
url : 'store.php',
method : 'POST',
totalProperty: 'total',
root : 'rows',
successProperty: 'success',
idProperty : 'idCategory',
fields : fields
});


store.load({
callback: function(){
var tpl = new Ext.XTemplate('<tpl for="."><li><a href="#{idCategory}">{Category:stripTags}</a></li></tpl>');
tpl.overwrite('sample-menu', catalog);
var sideBoxEl = bodyEl.child('div[class=side-box]');
Ext.select('#sample-spacer').remove();
doResize();
}
});


Json returned from store.php:


{"success":true,"total":18,"rows":[{"idCategory":"999001","Category":"Combination Examples","Screens":[{"title":"FeedViewer","url":"feed-viewer\/view.html","icon":"feeds.gif","desc":"RSS feed reader example application that features a swappable reader panel layout.","status":"i","date":"2010-11-30 00:00:00"},{"title":"Web Desktop","url":"desktop\/desktop.html","icon":"desktop.gif","desc":"Demonstrates how one could build a desktop in the browser using Ext components including a module plugin system.","status":"u","date":"2011-02-18 00:00:00"},{"title":"Ext JS Calendar","url":"calendar\/index.html","icon":"calendar.gif","desc":"Example Calendar application. Demonstrates the new Day, Week and Month views and how to combine them.","status":"e","date":"2011-02-22 11:14:01"}]},{"idCategory":"999002","Category":"Offline Support","Screens":[{"title":"Simple Tasks","url":"tasks\/tasks.html","icon":"tasks.gif","desc":"Personal task management application example that uses <a href=\"http:\/\/gears.google.com\" target=\"_blank\">Google Gears<\/a> for data storage.","status":"i","date":"2011-02-01 00:00:00"}]},{"idCategory":"999003","Category":"Accessibility","Screens":[]},{"idCategory":"999004","Category":"Pivot Grid","Screens":[]},{"idCategory":"999005","Category":"Grids","Screens":[]},{"idCategory":"999006","Category":"Tabs","Screens":[]},{"idCategory":"999007","Category":"Charts","Screens":[]},{"idCategory":"999008","Category":"Windows","Screens":[]},{"idCategory":"999009","Category":"Trees","Screens":[]},{"idCategory":"999010","Category":"LayoutManagers","Screens":[]},{"idCategory":"999011","Category":"Combo Box","Screens":[]},{"idCategory":"999012","Category":"Forms","Screens":[]},{"idCategory":"999013","Category":"Toolbars and Menus","Screens":[]},{"idCategory":"999014","Category":"Templates and DataView","Screens":[]},{"idCategory":"999015","Category":"Drag and Drop","Screens":[]},{"idCategory":"999016","Category":"Direct","Screens":[]},{"idCategory":"999017","Category":"Miscellanious","Screens":[]}]}



whatever i try, the right menu (sample-menu) shows 'undefined' or nothing, the content panel looks fine !