我想创建一个dashhtml组件来显示一个具有一定深度的嵌套可折叠树。我有一个htmldiv,我希望它包含一个根html.Ul
。
对于每个深度,我有一个标签列表和一个列表列表,其中包含对应的子树,它们是下一个深度的标签。在
html.Ul([
html.Li([
'subtotal1',
html.Ul([html. Li([...] ) ]),
'subtotal2',
html. Ul([html. Li([...]) ] )
] )
])
这是我对一个深度的代码:
^{pr2}$在哪里
fp_data[0]['unique'] = ['Total']
fp_data[0]['lists'] = [['Total|Shape','Total|FirstOrder']]
fp_data[1]['unique'] = ['Total|Shape','Total|FirstOrder']
fp_data[1]['lists'] = [['Total|Shape|Mean','Total|Shape|Kurtosis'],
['Total|FirstOrder|Mean','Total|FirstOrder|GrayLevel']]
fp_data[2]['unique'] = ['Total|Shape|Mean','Total|Shape|Kurtosis','Total|FirstOrder|Mean','Total|FirstOrder|GrayLevel']
fp_data[2]['lists'] = [
['Total|Shape|Mean|x','Total|Shape|Mean|y'],
['Total|Shape|Kurstosis|x','Total|Shape|Kurstosis|y'],
['Total|FirstOrder|Mean|x','Total|FirstOrder|Mean|y'],
['Total|FirstOrder|Graylevel|x','Total|FirstOrder|GrayLevel|y'],
]
编辑:提供更多的试验数据:
html_lists = []
for i in reversed(range(0,3)):
html_ul_list = html.Ul([],style = {'text-align':'left', 'marginLeft':'5px'})
pp.pprint(fp_data[i], indent = 4)
for idxcat,cat in enumerate(fp_data[i]['unique']):
print('idxcat',idxcat)
print(fp_data[i]['lists'])
html_ul_list.children.append(
html.Li([cat,
html.Ul(
[html.Li(fp_data[i]['lists'][idxcat][idx]) for idx in range(0,len(fp_data[i]['lists'][idxcat]))]
)
])
)
html_lists.append(html_ul_list)
目前没有回答
相关问题 更多 >
编程相关推荐