Generating Items in ExtJS with JSON (php/mysql)
After some time having a really hardcore sex whit the ExtJS framework (i was on the passive side) i found the solutions of the question about the life, the universe and everything else and it isn’t 42!
Here is the source :
-
-
Ext.Ajax.request({
-
url : 'http://localhost/oc/api.php',
-
params : {
-
a : 'tabs'
-
},
-
-
method : 'GET',
-
// This is the output of api.php
-
// {"data":[{"title":"tab 1","id":"0"},{"title":"tab 2","id":"1"}]}
-
-
success : function(result, request) {
-
jsonData = Ext.util.JSON.decode(result.responseText);
-
-
// here we are generating an array with JSON objects
-
-
var personalPanel = new Ext.form.FormPanel({
-
-
title : 'Personal',
-
-
defaultType : 'tabpanel',
-
defaults : {
-
-
msgTarget : 'side'
-
},
-
layoutConfig : {
-
-
},
-
items : [{
-
xtype : "tabpanel",
-
items : jsonData.data
-
// Here we are using the jsonData.data (.data because my json formated output has a root key "data:…"
No need to write the the end of the script, this was the most important part of it.


Comments
Just what I was looking for
Thanks for letting ExtJS have sex with you:)
Write a Comment