0

I have the following data in 2 different arrays:

Level 1

3.0 abc

2.1 xyz

2.0 pqr

Level 2

3.0.0.8 abc

3.0.0.7 pqr

2.1.0.155 lmn

2.1.0.151 rst

2.0.5.16 jhw

2.0.0.96 lqs

Now I want to arrange them in a collapsible tree fashion, which would look like this:

(+) 3.0 abc

  - 3.0.0.8 abc

  - 3.0.0.7 pqr

(+) 2.1 xyz

  - 2.1.0.155 lmn

  - 2.1.0.151 rst

(+) 2.0 pqr

  - 2.0.5.16 jhw

  - 2.0.0.96 lqs

I know it can be done with Javascript and Jquery. But can someone give me some sample code or some pointers to some very basic code which I can understand.

4

1 回答 1

1

看看jqTree

通过遍历您的数组并使用substring 或 substr来匹配和合并,创建一个标签(又名父母)和孩子的哈希数组。

于 2012-10-18T23:35:09.600 回答