workflow::tree::sorter::sort_list_of_lists (public)

 workflow::tree::sorter::sort_list_of_lists -list list -sort_by sort_by \
    -object_id object_id -parent_object_id parent_object_id

Defined in packages/workflow/tcl/workflow-tree-procs.tcl

Sort the given list-of-lists. The list should have 3-4 columns:

  • Display Name (should have any padding you want)
  • Object ID
  • Parent Object ID
  • Object Name

The display name is the only column which is not critical for sorting the tree.

Example:


    # Get a list that can be used as the options of a 'select' widget in ad_form
    set directories [db_list_of_lists get_directories {
	select  lpad(' ', (level-1)*4*6 + 1, ' ') || directory_name as directory_name,
	                 directory_id,
	                 parent_directory_id,
	                 directory_name
	           from  directories
	         start   with parent_directory_id    is null
	         connect by prior directory_id       = parent_directory_id
    }]
     
    # Sort the options
    set directories [tree::sorter::sort_lists_of_lists -list $directories -sort_by 3 -object_id 1 -parent_object_id 2]
    

Switches:
-list (required)
The list-of-lists that should be sorted as a tree.
-sort_by (required)
The index of the element in each row which should be used to sort by.
-object_id (required)
The index of the element in each row which uniquely identifies it.
-parent_object_id (required)
The index of the element in each row which contains the unique identifier of its parent.
Author:
helsleya@cs.ucr.edu

Partial Call Graph (max 5 caller/called nodes):
%3

Testcases:
No testcase defined.
[ show source ]
Show another procedure: