click and double click events for rows

This commit is contained in:
Roland Gruber 2018-10-27 16:42:31 +02:00
parent 62ae3267d2
commit fe5260b5e6
1 changed files with 31 additions and 1 deletions

View File

@ -4682,6 +4682,10 @@ class htmlResponsiveTable extends htmlElement {
private $cssOddRow; private $cssOddRow;
/** CSS class for even row numbers */ /** CSS class for even row numbers */
private $cssEvenRow; private $cssEvenRow;
/** onclick code (row number => code) */
private $onClick = array();
/** ondoubleclick code (row number => code) */
private $onDoubleClick = array();
/** /**
* Creates the table. * Creates the table.
@ -4739,7 +4743,15 @@ class htmlResponsiveTable extends htmlElement {
if (!empty($cssClasses)) { if (!empty($cssClasses)) {
$cssClass = ' class="' . implode(' ', $cssClasses) . '"'; $cssClass = ' class="' . implode(' ', $cssClasses) . '"';
} }
echo '<tr ' . $cssClass . '>'; $onClick = '';
if (!empty($this->onClick[$counter])) {
$onClick = ' onclick="' . $this->onClick[$counter] . '"';
}
$onDoubleClick = '';
if (!empty($this->onDoubleClick[$counter])) {
$onDoubleClick = ' ondblclick="' . $this->onDoubleClick[$counter] . '"';
}
echo '<tr ' . $cssClass . $onClick . $onDoubleClick . '>';
for ($i = 0; $i < $titleCount; $i++) { for ($i = 0; $i < $titleCount; $i++) {
echo '<td data-label="' . $this->titles[$i] . '">'; echo '<td data-label="' . $this->titles[$i] . '">';
$ids = parseHtml($module, $row[$i], $values, $restricted, $tabindex, $scope); $ids = parseHtml($module, $row[$i], $values, $restricted, $tabindex, $scope);
@ -4770,6 +4782,24 @@ class htmlResponsiveTable extends htmlElement {
$this->cssEvenRow = $evenClass; $this->cssEvenRow = $evenClass;
} }
/**
* Sets the onclick code for the rows.
*
* @param array $calls row number => code
*/
public function setOnClickEvents($calls) {
$this->onClick = $calls;
}
/**
* Sets the ondoubleclick code for the rows.
*
* @param array $calls row number => code
*/
public function setOnDoubleClickEvents($calls) {
$this->onDoubleClick = $calls;
}
} }