25 parent::__construct(
$identifier, null,$modelInstance);
27 $this->content[
"table"]->setDefinition()->addClass(
"_element");
31 if(!$this->_generated){
32 $this->_instanceViewer->setInstance($this->_modelInstance);
34 $table=$this->content[
"table"];
37 if(isset($this->_toolbar)){
40 if(isset($this->_colWidths)){
45 $this->_generated=
true;
47 return parent::compile($js,$view);
54 $values= $this->_instanceViewer->getValues();
55 $captions=$this->_instanceViewer->getCaptions();
56 $fields=$this->_instanceViewer->getVisibleProperties();
57 $count=$this->_instanceViewer->count();
58 $this->
setProperty(
"data-ajax", $this->_instanceViewer->getIdentifier());
59 for($i=0;$i<$count;$i++){
60 $row=$table->addRow([$captions[$i],$values[$i]]);
61 $row->getItem(1)->setProperty(
"data-field", $fields[$i]);
66 if(is_string($index)){
67 $fields=$this->_instanceViewer->getVisibleProperties();
68 $index=array_search($index, $fields);
70 if(is_numeric($index)){
71 $values= $this->_instanceViewer->getValues();
72 if(isset($values[$index])){
73 return $values[$index];
83 return $this->_instanceViewer->getFieldName($index);
91 return $this->identifier.
"-{$prefix}-".$name;
100 return $this->content[
"table"];
118 $this->content[
"table"]->onNewRow($callback);
127 $this->_colWidths[0]=$width;
132 $this->_colWidths[1]=$width;
137 $this->_colWidths=$widths;
143 $js->execOn(
"click",
"#".$this->_identifier.
" .ui.toggle",
'var active=$(this).hasClass("active");$(this).children("i").toggleClass("up",active).toggleClass("down",!active);var nextTd=$(this).closest("td").next("td");nextTd.children(":not(.toggle-caption)").toggle(active);nextTd.children(".toggle-caption").toggle(!active);$(this).trigger({type:"toggled",active: active,caption: nextTd.children(".toggle-caption")});');
setProperty($name, $value)
Semantic HTML Table component.
static sortAssociative($array, $sortedKeys=array())