in reply to Tree module select

Even if one the favourite mantras here is "look for an existing module", in this case I would consider implementing my own solution. Depending on your constraints/priorities, you could implement each group as an array with references to the elements belonging to it, or add to each element an array of references to the groups it belongs to, or put all couples (\$group, \$element) in an array. It shouldn't take that long, and probably less than finding and customizing the module you are looking for.

I'd be glad to suggest more specific solutions, but I have problems figuring out some elements from your post. For instance, do you have deeper nesting levels, is the table you are talking about a relational database table?


Best regards

Antonio

The stupider the astronaut, the easier it is to win the trip to Vega - A. Tucket

Replies are listed 'Best First'.
Re: Re: Tree module select
by wichard (Initiate) on Oct 15, 2002 at 12:10 UTC
    Thanks for the help
    My tree-like data may look like this:

    3160
      |---8500010
      |---8500020
      |      |----8500021
      |      |       |----8500121
      |      |       \----8500122
      |      |----8500022
      |      \----8500023
      |              |----8500024
      |              \----8500025
      |---8500021
      |       |---8500121
      |       \---8500122
      \---8500030
    3171
    |----2800010 |----2800020 | \----8500025 |----8500010 |----8500020 | |----8500021 | | |----8500121 | | \----8500122 | |----8500022 | \----8500023 | |----8500024 | \----8500025 \---8500023 |----8500024 \----8500025

    8500025 belong to 3160 and 3171
    8500020 belong to 3160 and 3171

    It can be printed as this:

    3160
      |---8500010
      |---8500020
      |---8500021
      \---8500030
    3171
    |----2800010 |----2800020 | \----8500025 |----8500010 |----8500020 \---8500023

    The table may like this:
    -------------------------
     parentid    |   iiem id
    -------------------------
                 |    3160
      3160       |  8500010
      3160       |  8500020
      8500020    |  8500021
      8500021    |  8500121
      8500021    |  8500122
      8500020    |  8500022
      8500020    |  8500023
      8500023    |  8500024
      8500023    |  8500025
      3160       |  8500021
      3160       |  8500030
                 |    3171
      3171       |  2800010
      3171       |  2800020
      2800020    |  8500025
      3171       |  8500010
      3171       |  8500020
      3171       |  8500023
    ---------------------------
    

    I don't know which data stucture i should use.