2013-10-24 4 views
1

Моя JSON, что я хочу сделать, как дерево являетсяПочему моя скрипка не ведет себя правильно?

{ 
    "productOfferings": [ 
     { 
      "text": "Mobile subscription with Internet access 2GB and iPad 32GB", 
      "description": "Joors 2GB mobile broadband and iPad 32GB", 
      "productOfferings": [ 
       { 
        "id": 5, 
        "text": "Ipad with 32 GB storage", 
        "description": "A iPad 32 GB Product Offering", 
        "productSpecification": { 
         "id": 5, 
         "text": "IPad", 
         "description": "" 
        } 
       }, 
       { 
        "id": 8, 
        "text": "Mobile subscription with Sim Card and Internet access 2GB", 
        "description": "Mobile subscription with Sim Card and Internet access 2GB", 
        "productSpecification": { 
         "id": 9, 
         "text": "Mobile subscription with sim card and Internet access", 
         "description": "Mobile subscription with sim card and Internet access", 
         "productSpecifications": [ 
          { 
           "id": 2, 
           "text": "Mobile subscription with Sim Card", 
           "description": "This is the classic Subscription product of a Mobile Network totally void of Services, so it can only be used for accessing a HPLMN. Simply put a MSISDN + SIM" 
          }, 
          { 
           "id": 4, 
           "text": "Mobile Internet access", 
           "description": "This is a GPRS Service for a Mobile Network Access Product for accessing Internet" 
          } 
         ] 
        } 
       } 
      ] 
     } 
    ] 
} 

Я хочу, чтобы сделать дерево с ExtJS, как это делает с моей JSON в jsonviewer.stack.hu

enter image description here

I пытался сделать это с огурчик, но это не может быть сделано, и несколько вещей странные скрипки:

http://jsfiddle.net/niklasro/auBTH/24/

Когда я делаю корень невидимым, он становится двумя корнями. Очень странно. И displayField не может быть установлен, он должен иметь имя «текст», но я не могу изменить свой json только из-за extJS. Я хочу, чтобы текстовое поле имело имя «имя». И я пытался отобразить produtSpecification, например jsonviewer.stack, но это несовместимо, как это сделать. Вы можете мне помочь?

ответ

Смежные вопросы