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"
                            }
                        ]
                    }
                }
            ]
        }
    ]
}

jsonviewer.stack.hu の json で行うように、extJS でツリーをレンダリングしたい

ここに画像の説明を入力

私はフィドルでそれをやろうとしましたが、それはできませんでした.フィドルについていくつかのことが奇妙です:

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

ルートを非表示にすると、2 つのルートになります。非常に奇妙な。また、displayField を設定することはできません。名前は「text」にする必要がありますが、extJS のためだけに json を変更できません。テキストフィールドに「name」という名前を付けたい。そして、jsonviewer.stackのようにprodutSpecificationをレンダリングしようとしましたが、それを行う方法がわかりません。手伝って頂けますか?

4

1 に答える 1

1

最初のヒントとして、id は JSON 内で一意である必要があります: http://my.jetscreenshot.com/6795/20131025-xarw-24kb

于 2013-10-25T12:53:49.603 に答える