Kaynağa Gözat

updated UI::table

Piotr Labudda 9 yıl önce
ebeveyn
işleme
22d44bf19a
1 değiştirilmiş dosya ile 6 ekleme ve 1 silme
  1. 6 1
      SE/se-lib/UI.php

+ 6 - 1
SE/se-lib/UI.php

@@ -115,6 +115,7 @@ class UI {
 		$rows = V::get('rows', array(), $params);
 		$cols_help = V::get('cols_help', array(), $params);
 		$caption = V::get('caption', '', $params);
+		$cellPadding = V::get('cell_padding', 2, $params, 'int');
 		$showLp = (!V::get('disable_lp', false, $params));
 		$countCols = 1;
 		if (empty($cols) && !empty($rows)) {
@@ -182,8 +183,12 @@ class UI {
 				self::startTag('tr', $trAttrs); echo "\n";
 				if ($showLp) { self::tag('th', [ 'style' => "padding:2px; color:#ccc" ], $i); echo "\n"; }
 				foreach ($cols as $colName) {
+					$rowAttrs = [ 'style' => "padding:{$cellPadding}px" ];
+					if (!empty($row["@onClick[{$colName}]"])) $rowAttrs['onClick'] = $row["@onClick[{$colName}]"];
+					if (!empty($row["@class[{$colName}]"])) $rowAttrs['class'] = $row["@class[{$colName}]"];
+					if (!empty($row["@style[{$colName}]"])) $rowAttrs['style'] .= "; " . $row["@style[{$colName}]"];
 					if (in_array($colName, $hiddenCols)) continue;
-					self::tag('td', [ 'style' => "padding:2px" ], V::get($colName, '', $row)); echo "\n";
+					self::tag('td', $rowAttrs, V::get($colName, '', $row)); echo "\n";
 				}
 				self::endTag('tr'); echo "\n";
 			}