2012-02-23 9 views
0

私はツリーグリッドを稼働させることができません。 モデル、店舗、ツリーグリッドを定義しました(下記参照)。 ツリーグリッド内にターゲットが表示され、データは非同期に読み込まれます(フィドラーでチェックされ、2つの行が戻ってきます)。しかし、ツリーグリッドは空のセルを持つ2つの行を表示します。カスタムモデルと非同期ロードを使用したextJS4ツリーグリッドの悲嘆

私はデバッグを試みましたが、実際にはモデルデータは子のrawプロパティの下にあります(リーフやiconClsなどの一部のフィールドはdataというプロパティを除いています) dataIndexが適切なモデルフィールドを指しているにもかかわらず、

ツリーグリッドのように、モデルで定義されたフィールドが見つかりませんでしたか?ここで

がソースです(私はSalesforceのVFORCEにこれを統合していますので、私はサンドボックスを使用しています、Salesforceはフィールドをマージ{!}も有効であり、適切にレンダリング)

Ext4.onReady(function() { 

    var target = '{!$Component.childBlock.childTreeDiv}'; 


    Ext4.define('ConfigurationItem', { 
     extend: 'Ext4.data.Model', 
     fields: [ 
      { 
      id: 'id', 
      type: 'string'}, 
     { 
      id: 'name', 
      type: 'string'}, 
     { 
      id: 'recordType', 
      type: 'string'}, 
     { 
      id: 'ciName', 
      type: 'string'}, 
     { 
      id: 'alias', 
      type: 'string'}, 
     { 
      id: 'model', 
      type: 'string'}, 
     { 
      id: 'status', 
      type: 'string'}, 
     { 
      id: 'description', 
      type: 'string'}, 
     { 
      id: 'leaf', 
      type: 'bool'}, 
     { 
      id: 'iconCls', 
      type: 'string'} 
     ] 
    }); 

    var store = Ext4.create('Ext4.data.TreeStore', { 
     model: 'ConfigurationItem', 
     root: { 
      nodetype: 'async', 
      id: '{!CI__c.Id}', 
      expanded: true 
     }, 
     proxy: { 
      type: 'ajax', 
      url: 'json_CIChildren', 
      reader: { 
       type: 'json', 
       root: 'children' 
      } 
     } 
    }); 

    tree = Ext4.create('Ext4.tree.Panel', { 
     width: document.getElementById(target).offsetWidth, 
     autoHeight: true, 
     title: 'Child Configuration Items', 
     collapsible: true, 
     titleCollapse: true, 
     renderTo: target, 
     rootVisible: false, 
     store: store, 
     multiSelect: true, 
     singleExpand: true, 
     columns: [ 
      { 
      type: 'treecolumn', 
      text: 'CI#', 
      dataIndex: 'name'}, 
     { 
      text: 'Type', 
      dataIndex: 'recordType'} 
     ] 
    }); 
});​ 

要求json_CIChildren?_dc=1329830854458&node=a0NT0000006tYKzMAMに有効でした( root.idparentIDはOK伝播してしまった)と有効なJSONに戻ってきた:

{ "children" : [ 
     { 
      "id": "a0NT0000006tswhMAA", 
      "name": "CI334593834", 
      "recordType": "Rack", 
      "ciName": "Empty rack", 
      "alias": "", 
      "model": "", 
      "status": "", 
      "description": "", 
      "leaf": "true", 
      "iconCls": "x4-ciicon-Rack" 
     }, 
     { 
      "id": "a0NT0000006tYKuMAM", 
      "name": "CI2345234", 
      "recordType": "Service", 
      "ciName": "Business Connect - Premium", 
      "alias": "", 
      "model": "", 
      "status": "", 
      "description": "", 
      "leaf": "true", 
      "iconCls": "x4-ciicon-Service" 
     } 
]} 

は私が間違って何をしているのですか?なぜ、ツリーグリッドはnameフィールドとrecordTypeフィールドを見ないのですか?

これは店舗がNodeInterfaceのようなフィールドだけを見て、データプロパティに自分のカスタムデータがないためですか?

答えて

1

私の問題はあなたのモデルフィールドが正しくマップされていないと思います。各フィールドの "id"プロパティは、代わりに 'name'プロパティでなければなりません。

+0

はい、これで問題は解決しました。ありがとう。 – mmix

関連する問題