Class ::xo::Table::BootstrapTableRenderer
::xo::Table::BootstrapTableRenderer
create ...
Class Relations
- class: ::xotcl::Class
![[i]](/resources/acs-subsite/ZoomIn16.gif)
- superclass: ::xo::Table::TABLE3
![[i]](/resources/acs-subsite/ZoomIn16.gif)
::xotcl::Class create ::xo::Table::BootstrapTableRenderer \
-superclass ::xo::Table::TABLE3
Methods (to be applied on instances)
init_renderer (scripted)
next
set :css.table-class "table table-striped"
set :css.tr.even-class "align-middle"
set :css.tr.odd-class "align-middle"
set :id [::xowiki::Includelet js_name [::xowiki::Includelet html_id [self]]]
render (scripted)
::template::CSS require_toolkit -css
if {![nsf::is object [self]::__actions]} {:actions {}}
if {![nsf::is object [self]::__bulkactions]} {:__bulkactions {}}
set bulkactions [[self]::__bulkactions children]
if {[[self]::__bulkactions exists __identifier]} {
set name [[self]::__bulkactions set __identifier]
html::div -id ${:id}_wrapper -class "table-responsive" {
html::form -name $name -id $name -method POST {
html::div -id ${:id}_container {
html::table -id ${:id} -class ${:css.table-class} {
:render-actions
:render-body
}
:render-bulkactions
}
}
}
} else {
set name [::xowiki::Includelet js_name [self]]
html::div -id ${:id}_wrapper -class "table-responsive" {
html::div -id ${:id}_container {
html::table -id ${:id} -class ${:css.table-class} {
:render-actions
:render-body
}
}
}
}render-body (scripted)
html::thead {
html::tr -class list-header {
foreach o [[self]::__columns children] {
if {[$o hide]} continue
$o render
}
}
}
ad_try {
set children [:children]
} on error {errorMsg} {
html::div -class "alert alert-danger" {
html::span -class danger {
html::t $errorMsg
}
}
return
}
html::tbody {
foreach line [:children] {
html::tr -class [expr {[incr :__rowcount]%2 ? ${:css.tr.odd-class} : ${:css.tr.even-class} }] {
foreach field [[self]::__columns children] {
if {[$field hide]} continue
if {[$field istype HiddenField]} continue
set CSSclass [list "list" {*}[$field CSSclass]]
html::td [concat [list class $CSSclass] [$field html]] {
$field render-data $line
}
}
}
}
}render-bulkactions (scripted)
set bulkactions [[self]::__bulkactions children]
if {[llength $bulkactions] > 0} {
html::div -class "btn-group align-items-center" -role group -aria-label "Bulk actions" {
html::span -class "bulk-action-label" {
html::t "#xotcl-core.Bulk_actions#:"
}
html::ul -class compact {
set bulkaction_container [[lindex $bulkactions 0] set __parent]
set name [$bulkaction_container set __identifier]
foreach bulk_action $bulkactions {
set id [::xowiki::Includelet html_id $bulk_action]
html::li {
html::a -class [::template::CSS class bulk-action] -rule button -title [$bulk_action tooltip] -href # -id $id {
html::t [$bulk_action label]
}
}
set script [subst {
acs_ListBulkActionClick("$name","[$bulk_action url]");
}]
if {[$bulk_action confirm_message] ne ""} {
set script [subst {
if (confirm('[$bulk_action confirm_message]')) {
$script
}
}]
}
template::add_event_listener -id $id -preventdefault=false -script $script
}
}
}
}