24 parent::__construct(
$identifier,
null,$modelInstance);
26 $this->content[
"table"]->setDefinition()->addClass(
"_element");
30 if(!$this->_generated){
31 $this->_instanceViewer->setInstance($this->_modelInstance);
33 $table=$this->content[
"table"];
36 if(isset($this->_toolbar)){
39 if(isset($this->_colWidths)){
42 $this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE,
"table",PositionInTable::AFTERTABLE]);
44 $this->_generated=
true;
46 return parent::compile($js,$view);
53 $values= $this->_instanceViewer->getValues();
54 $captions=$this->_instanceViewer->getCaptions();
55 $fields=$this->_instanceViewer->getVisibleProperties();
56 $count=$this->_instanceViewer->count();
57 $this->
setProperty(
"data-ajax", $this->_instanceViewer->getIdentifier());
58 for($i=0;$i<$count;$i++){
59 $row=$table->addRow([$captions[$i],$values[$i]]);
60 $row->getItem(1)->setProperty(
"data-field", $fields[$i]);
65 if(is_string($index)){
66 $fields=$this->_instanceViewer->getVisibleProperties();
67 $index=array_search($index, $fields);
69 if(is_numeric($index)){
70 $values= $this->_instanceViewer->getValues();
71 if(isset($values[$index])){
72 return $values[$index];
82 return $this->_instanceViewer->getFieldName($index);
90 return $this->identifier.
"-{$prefix}-".$name;
99 return $this->content[
"table"];
117 $this->content[
"table"]->onNewRow($callback);
126 $this->_colWidths[0]=$width;
131 $this->_colWidths[1]=$width;
136 $this->_colWidths=$widths;
141 if(JString::isNotNull($this->_identifier))
142 $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")});');
execOn($event, $element, $js, $parameters=array())
Executes the javascript code $js when $event fires on $element.
setProperty($name, $value)
Semantic HTML Table component.