ツリーパネルのサンプルを作成しています。無限のツリーしか取得できません。何が間違っていますか?ExtJs 4.2 treepanel
MODEL
Ext.define('mdlDocumentosTree', {
extend: 'Ext.data.Model',
fields:[
{name:'id', type:'string', mapping:''},
{name:'text', type:'string', mapping:''},
{name:'leaf', type:'boolean', mapping:''},
{name:'iconCls', type:'string', mapping:''}
]
});
STORE
Ext.define('strDocumentosTree', {
extend: 'Ext.data.TreeStore',
model: 'mdlDocumentosTree',
autoLoad: false,
proxy: {
type: 'ajax',
api: {read: 'some url'},
reader: {
type: 'json',
root: 'data',
totalProperty: 'total',
successProperty: 'success'
}
}
});
VIEW
var arbolcarpetas=new Ext.tree.Panel({
itemId:'arbolcarpetas',
title:'Archivos del Expediente',
region:'west',
width:250,
collapsible:true,
border: false,
autoScroll:true,
store:almacenDocumentos,
rootVisible: false
})
私はこのコマンドを使用してツリーストアをロードコントローラのコントローラ
:
Ext.ComponentQuery.query('viewFichaDetalle #arbolcarpetas')[0].getStore().load();
とストアのPHPである:
<?php
$x=0;
$nodes = array();
while($x<10){
array_push($nodes,array('text'=>"A".$x, 'id'=>$x,'children'=>array('text'=>"A".rand(10,100),'id'=>$x,leaf=>true,'iconCls'=>'icon-excel')));
$x++;
}
echo json_encode($nodes);
?>
結果は、この無限木である:
私は間違っている?どんな手掛かり?
あなたはフィドルを作ってください。あなたがそうするときは、あなたのモデルが['Ext.data.TreeModel']から派生していないかどうかを確認してください(http://docs.sencha.com/extjs/4.2.2/#!/api/Ext .data.TreeModel)。 – Alexander
PHPコードでは、何を達成しようとしていますか? ExtJSコードには何の問題もないので、ツリー内のノードを展開すると、ストアURLがヒットし、PHPコードが実行され、同じノードセットが返されます。 – Saloo
あなたの応答データも投稿できますか? –