No announcement yet.

Grid and hierarchical view in V8

  • Filter
  • Time
  • Show
Clear All
new posts

  • Grid and hierarchical view in V8

    Hi all,

    After a period I've just started to use SC again and in particular V8 . I got an instant question... (hole in my memory....)
    I have a table where I got the field ID and the ParentID just to define a hierarchy on the same table.
    Every record has its own parent starting from level 0

    I have to represent it on a grid and I would like to see the different levels grouped with the + icon on the beginning to open the level.
    I got three level so I need also that the second level has the + icon in front of the sub row...

    + LEVEL 0 ID
    ----------LEVEL 01 ID
    ----------+ LEVEL 02 ID
    --------------------LEVEL 021 ID
    --------------------LEVEL 022 ID
    I don't remember how to produce such kind of grid. Need I to organize it as nested grid ? Of the same table ??? Not possible I suppose
    Many thanks
    Attached Files
    Last edited by giovannino; 10-01-2014, 12:00 PM.

  • #2
    I think you can to do a grid with details.


    • #3
      If I'm not wrong details show you the record detail only.
      I need to see all hierarchy before to arrive to record level.
      It's like a master details view but I need more levels that two.


      • #4
        I'm trying to use Grid and Nested Grid but I've still problems

        Hi ,
        after some tests.... this is what I've done. Grid and Nested Grid . See image

        I need now to hide the second level of hierarchy on main grid becouse it's correctly present on its parent detail
        How can it do ??
        Attached Files


        • #5
          I needed some time ago the same, but i created a menu nested from a table recursive.
          Would be good id SC Team helps with this, because is very necesary for our work.
          Attach image from my menu.
          Attached Files
          Last edited by alvagar; 10-02-2014, 09:42 AM. Reason: error of some words


          • #6
            Hi Alvagar,

            Very nice !!! How did you build it ?

            I did ... in some way , adding a where clause but I'm not satisfied...
            Attached Files


            • #7
              I did it with a table recursive. I hope can help you.

              You must change the SQL and fields name

              First All you must create a TREE MENU with SC
              (for example: treemenu_agr)

              THEN CREATE A PHP METHOD: GetChilds with parameters:
              menu by reference
              sql by value
              codefather by value

              This is code for GetChilds :

              sc_lookup(rs_child, $sql.$codefather. " order by agr_nmbre");
              foreach({rs_child} as $agr_child)
              $agr_cdgo = $agr_child[0];
              $agr_cdgop = $agr_child[1];
              $agr_nmbre = $agr_cdgo."-".$agr_child[2];

              sc_appmenu_add_item($menu,"$agr_cdgo","$codefather ",$agr_nmbre,form_agr_tree,neg_cdgo=[neg_cdgo];agr_cdgo=$agr_cdgo,);
              getChilds($menu, $sql, $agr_cdgo );

              ONLOAD EVENT
              // Get params from a app.
              if(isset($_POST['nmgp_parms']) && substr($_POST['nmgp_parms'], 0, 10)=="v_agr_cdgo" && isset([v_agr_cdgo]) && !empty([v_agr_cdgo]))
              $agr_cdgo_parm = [v_agr_cdgo];

              $menu = "treemenu_agr";

              $sql_root = "select agr_cdgo, agr_cdgop, agr_nmbre from agr_agrpcion where neg_cdgo = ".[neg_cdgo]." and agr_cdgop is null order by agr_nmbre";
              $sql_child = "select agr_cdgo, agr_cdgop, agr_nmbre from agr_agrpcion where agr_cdgop = ";
              sc_lookup(rs_root, $sql_root);

              $items = false;

              foreach({rs_root} as $agr_root)
              $items = true;
              $agr_cdgo = $agr_root[0];
              $agr_cdgop = $agr_root[1];
              $agr_nmbre = $agr_cdgo."-".$agr_root[2];

              //sc_appmenu_add_item("String Menu_Name", "Id_Item", "Id_Parent", "Label", "Aplication", "Parameters", "Icon", "Hint", "Target")
              sc_appmenu_add_item($menu,"$agr_cdgo",,$agr_nmbre, form_agr_tree,neg_cdgo=[neg_cdgo];agr_cdgo=$agr_cdgo);
              getChilds($menu, $sql_child, $agr_cdgo);


              if(!$items) {
              sc_redir(form_agr, neg_cdgo=[neg_cdgo];agr_cdgo=0, "$menu");


              • #8
                WOWWWWWW !!!! Good job !!! Not a piece of cake... ;-(


                • #9
                  Ok. Giovannino. I Hope that helps.