我想要呈现为树的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渲染一个树,就像在jsonviewer.stack.hu中用json一样
我试着用小提琴做,但做不到,小提琴有几个奇怪的地方:
http://jsfiddle.net/niklasro/auBTH/24/
当我使根不可见时,它就变成了两个根。很奇怪。并且displayField不能被设置,它的名称必须是“text”,但我不能仅仅因为extJS而更改我的json。我希望文本字段的名称为“name”。我一直在尝试像jsonviewer.stack那样呈现produtSpecification,但无法理解如何做到这一点。你能帮我吗?