37 if (isset($rowCount) && isset($colCount))
48 $count = $this->
count();
49 for ($i = $count; $i < $rowCount; $i ++) {
60 $this->_template =
"%wrapContentBefore%%content%%wrapContentAfter%";
71 $count = $this->
count();
73 $tr->setContainer($this, $count);
74 if ($this->_focusable) {
75 $tr->setProperty(
'tabindex', $count);
77 $tr->setTdTagName($this->_tdTagNames[$this->tagName]);
78 if (isset($value) ===
true) {
79 $tr->setColCount($value);
94 return $this->
addItem($colCount);
107 $row = $this->
addRow($colCount);
122 return parent::getItem($index);
135 $col = $row->getItem($col);
159 $cell = $this->
getCell($row, $col);
160 if (isset($cell) ===
true) {
161 $cell->setValue($value);
195 $count = $this->
count();
197 if (! \is_array($values)) {
198 $values = \array_fill(0, $count, $values);
201 if (JArray::dimension($values) == 1 && $isArray)
206 $count = \min(\
sizeof($values), $count);
208 for ($i = 0; $i < $count; $i ++) {
209 $row = $this->content[$i];
210 $callback($row, $values[$i]);
216 $count = $this->
count();
217 if (! \is_array($values)) {
218 $values = \array_fill(0, $count, $values);
220 $count = \min(\
sizeof($values), $count);
221 for ($i = 0; $i < $count; $i ++) {
222 $this->
getCell($i, $colIndex)->setValue($values[$i]);
228 $count = $this->
count();
229 for ($i = 0; $i < $count; $i ++) {
230 $cell = $this->
getCell($i, $colIndex);
232 $cell->addVariations($variations);
238 $count = $this->
count();
239 for ($i = 0; $i < $count; $i ++) {
240 $cell = $this->
getCell($i, $colIndex);
242 $cell->addToProperty($name, $value);
248 $count = $this->
count();
249 if (! \is_array($values)) {
250 $values = \array_fill(0, $count, $values);
252 $this->
getItem($rowIndex)->setValues($values);
257 $count = $this->
count();
258 for ($i = 0; $i < $count; $i ++) {
259 $index = $this->content[$i]->getColPosition($colIndex);
260 if ($index !== NULL) {
261 $cell = $this->
getCell($i, $index);
271 $count = $this->
count();
272 for ($i = 0; $i < $count; $i ++) {
273 $maxRow = $this->content[$i]->count();
274 $index = $maxRow - $colIndex - 1;
275 if (($cell = $this->
getCell($i, $index)) !== NULL) {
276 if ($cell->getColspan() == 1)
284 return $this->
colAlign($colIndex,
"textCenterAligned");
288 return $this->
colAlign($colIndex,
"textRightAligned");
292 return $this->
colAlign($colIndex,
"textLeftAligned");
313 return $this->
count();
323 if ($this->
count() > 0)
324 $result = $this->
getItem(0)->count();
335 public function delete($rowIndex, $colIndex = NULL) {
336 if (isset($colIndex)) {
337 $row = $this->
getItem($rowIndex);
338 if (isset($row) ===
true) {
339 $row->delete($colIndex);
348 $row = $this->
getItem($rowIndex);
349 if (isset($row) ===
true)
350 $row->toDelete($colIndex);
355 $row = $this->
getItem($rowIndex);
356 if (isset($row) ===
true)
357 $row->toRowspanned($colIndex);
361 public function mergeCol($rowIndex = 0, $colIndex = 0) {
362 return $this->
getItem($rowIndex)->mergeCol($colIndex);
365 public function mergeRow($rowIndex = 0, $colIndex = 0) {
366 return $this->
getItem($rowIndex)->mergeRow($colIndex);
373 public function sort($colIndex) {
374 $this->content[0]->getItem($colIndex)->addToProperty(
"class",
"default-sort");
386 foreach ($rows as $row) {
387 $row->conditionalCellFormat($callback, $format);
394 foreach ($rows as $row) {
395 $cell = $row->getItem($colIndex);
396 $cell->conditionnalCellFormat($callback, $format);
409 foreach ($rows as $row) {
410 $row->conditionalRowFormat($callback, $format);
417 foreach ($rows as $row) {
418 $cell = $row->getItem($colIndex);
419 $cell->addToProperty(
"style",
"display:none;");
431 foreach ($rows as $row) {
432 $row->applyCells($callback);
444 foreach ($rows as $row) {
445 $row->apply($callback);
463 $functionExists = \function_exists($function);
464 foreach ($rows as $row) {
465 $cell = $row->getItem($colIndex);
466 $value = $cell->getContent();
468 $value = \call_user_func($function, $value);
469 if ($value !== $identiqual) {
470 if ($counter > 0 && isset($cellToMerge)) {
471 $cellToMerge->setRowspanned($counter);
474 $cellToMerge = $cell;
475 $identiqual = $value;
479 if ($counter > 0 && isset($cellToMerge)) {
480 $cellToMerge->setRowspanned($counter);
490 $this->_merged = $value;
499 $this->_focusable = $focusable;
Base class for Html collections.
addItem($item)
adds and returns an item
Base class for Semantic Html collections.
addToProperty($name, $value, $separator=" ")
addValues($values=array())
Adds values to the row cols.
setValues($values=array())
Sets values to the row cols.
a table content (thead, tbody or tfoot)
colLeftFromRight($colIndex)
setRowCount($rowCount, $colCount)
mergeIdentiqualValues($colIndex, $function="strip_tags")
conditionalRowFormat($callback, $format)
conditionalColFormat($colIndex, $callback, $format)
__construct($identifier, $tagName="tbody", $rowCount=NULL, $colCount=NULL)
addColVariations($colIndex, $variations=array())
createItem($value)
{The item factory.}
conditionalCellFormat($callback, $format)
addPropertyCol($colIndex, $name, $value)
colAlignFromRight($colIndex, $function)
mergeCol($rowIndex=0, $colIndex=0)
colCenterFromRight($colIndex)
setColValues($colIndex, $values=array())
getColCount()
Returns the number of columns (TD)
setFocusable(bool $focusable)
getCell($row, $col)
Returns the cell (HtmlTD) at position $row,$col.
_addOrSetValues($values, $callback)
Adds or sets the cells values.
toDelete($rowIndex, $colIndex)
colRightFromRight($colIndex)
getRowCount()
Returns the number of rows (TR)
addValues($values=array())
Adds the cells values.
toRowspanned($rowIndex, $colIndex)
setRowValues($rowIndex, $values=array())
colAlign($colIndex, $function)
addMergeRow($colCount, $value=null)
setValues($values=array())
Sets the cells values.
mergeRow($rowIndex=0, $colIndex=0)
setCellValue($row, $col, $value="")