View · Index

Unit 3 / Populating the Table Widget

# still in file xotcl-demo-note/www/index.tcl
#
# We populate the table widget with notes stored in the db
# We use the ::xo::db::Class->instance_select_query interface
#

db_foreach instance_select  [::demo::Note instance_select_query   -folder_id [$package_id folder_id]   -select_attributes [list content_length creation_user  "to_char(last_modified,'YYYY-MM-DD HH24:MI:SS') as last_modified"]] {
      index add  -name $name  -name.href [export_vars -base edit {item_id}]   -last_modified $last_modified   -size [expr {$content_length ne "" ? $content_length : 0}]   -edit.href [export_vars -base edit {item_id}]   -mod_user [::xo::get_user_name $creation_user]   -delete.href [export_vars -base delete {item_id}]
    }

set html [index asHTML]