php json_encoded array and nestedlist
Hello,
Is there anything special that needs to be done to special to make an array work in the nested list besides JSON encoding it in PHP. I have tried several times to prepare my array for the nested list but I get nothing.
here is the code that produces my array
Code:
foreach ($channels as $index => $c)
{
$node = $c['Content']['call_letters'];
// var_dump($node);
// exit();
if ($node == $c['Content']['call_letters'])
{
//$refactor[$node][$index] = $c['Content'];
$refactor[$node][$index] =
array('text' => $node,
'items'=> $c['Content']
);
}
}
here is my array:
Code:
array 'KKYO' => array 0 => array 'text' => string 'KKYO' (length=4) 'items' => array '_id' => string '4f128b336930f31137081969' (length=24) 'call_letters' => string 'KKYO' (length=4) 'channel_name' => string 'KKYO-Kyoto' (length=10) 'bcast_channel' => int 100 'start_time_utc' => float 1326650400 'program_id' => string '99344001' (length=8) 'title' => string 'Kyoto' (length=5) 1 => array 'text' => string 'KKYO' (length=4) 'items' => array '_id' => string '4f128b336930f3113708196a' (length=24) 'call_letters' => string 'KKYO' (length=4) 'channel_name' => string 'KKYO-Kyoto' (length=10) 'bcast_channel' => int 100 'start_time_utc' => float 1326657600 'program_id' => string '99344001' (length=8) 'title' => string 'Kyoto' (length=5) 2 => array 'text' => string 'KKYO' (length=4) 'items' => array '_id' => string '4f128b336930f3113708196b' (length=24) 'call_letters' => string 'KKYO' (length=4) 'channel_name' => string 'KKYO-Kyoto' (length=10) 'bcast_channel' => int 100 'start_time_utc' => float 1326664800 'program_id' => string '99344001' (length=8) 'title' => string 'Kyoto' (length=5)
'KSEO' => array 15 => array 'text' => string 'KSEO' (length=4) 'items' => array '_id' => string '4f128b2e6930f31137081950' (length=24) 'call_letters' => string 'KSEO' (length=4) 'channel_name' => string 'KSEO-Seoul' (length=10) 'bcast_channel' => int 101 'start_time_utc' => float 1326650400 'program_id' => string '99345001' (length=8) 'title' => string 'Seoul' (length=5) 16 => array 'text' => string 'KSEO' (length=4) 'items' => array '_id' => string '4f128b2e6930f31137081951' (length=24) 'call_letters' => string 'KSEO' (length=4) 'channel_name' => string 'KSEO-Seoul' (length=10) 'bcast_channel' => int 101 'start_time_utc' => float 1326657600 'program_id' => string '99345001' (length=8) 'title' => string 'Seoul' (length=5) 17 => array 'text' => string 'KSEO' (length=4) 'items' => array '_id' => string '4f128b2e6930f31137081952' (length=24) 'call_letters' => string 'KSEO' (length=4) 'channel_name' => string 'KSEO-Seoul' (length=10) 'bcast_channel' => int 101 'start_time_utc' => float 1326664800 'program_id' => string '99345001' (length=8) 'title' => string 'Seoul' (length=5) 18 =>
my nested list code
Code:
Ext.setup({
name: 'mapp',
onReady: function() {
Ext.define('Channels', {
extend: 'Ext.data.Model',
fields: [
{
name: "text",
type: "string"
}
]
});
channelstore = Ext.create('Ext.data.TreeStore', {
autoLoad: true,
model: "Channels",
defaultRootProperty: 'text',
proxy: {
type: 'ajax',
url : '/channels/channelList',
reader: {
type: 'json',
root: 'text'
}
}
});
channelPanel = Ext.create('Ext.NestedList', {
fullscreen: true,
title: 'Channels',
displayField: 'text',
store: channelstore
});
console.log(channelstore);
}
});
Any input is greatly appreciated.