Ver Fonte

added childRef filter in TableAjax

Piotr Labudda há 8 anos atrás
pai
commit
ac4abeca7e
1 ficheiros alterados com 26 adições e 1 exclusões
  1. 26 1
      SE/se-lib/TableAjax.php

+ 26 - 1
SE/se-lib/TableAjax.php

@@ -125,6 +125,10 @@ class TableAjax extends ViewAjax {
 		$this->_backRefFilter = $backRefFilter;
 		$this->_backRefFilter = $backRefFilter;
 	}
 	}
 
 
+	public function setChildRefFilter($childRefFilter) {
+		$this->_childRefFilter = $childRefFilter;
+	}
+
 	public function setFilterInit($filterInit) {
 	public function setFilterInit($filterInit) {
 		if ($this->_hasStateFilterInit()) {
 		if ($this->_hasStateFilterInit()) {
 			return;
 			return;
@@ -475,6 +479,23 @@ class TableAjax extends ViewAjax {
 					]);
 					]);
 				}
 				}
 			?>
 			?>
+			<?php
+				if ($this->_childRefFilter) {
+					echo UI::h('div', [ 'class' => "container" ], [
+						UI::h('div', [ 'class' => "alert alert-info" ], [
+							"Rekordy powiązane z rekordem {$this->_childRefFilter['primaryKey']} z ",
+							UI::h('a', [
+								'href' => "index.php?_route=ViewTableAjax&namespace={$this->_childRefFilter['namespace']}",
+							], $this->_childRefFilter['namespace']),
+							" - ",
+							UI::h('a', [
+								'href' => $this->rootUrl,
+								'style' => "color:red",
+							], "usuń filtr"),
+						]),
+					]);
+				}
+			?>
 			<div id="<?= $this->_htmlID; ?>"></div>
 			<div id="<?= $this->_htmlID; ?>"></div>
 		</div>
 		</div>
 		<?php
 		<?php
@@ -1255,7 +1276,7 @@ class TableAjax extends ViewAjax {
 						html: true,
 						html: true,
 						content: _popoverCell.html()
 						content: _popoverCell.html()
 					}
 					}
-					opts.template += '<div class="popover" role="tooltip" style="max-width:600px;width:400px;">';
+					opts.template += '<div class="popover" role="tooltip" style="max-width:600px;width:440px;">';
 					{
 					{
 						opts.template += '<div class="arrow"></div>';
 						opts.template += '<div class="arrow"></div>';
 						//opts.template += '<h3 class="popover-title"></h3>';
 						//opts.template += '<h3 class="popover-title"></h3>';
@@ -5513,6 +5534,10 @@ jQuery(document).ready(function(){
 			$params['__backRef'] = $this->_backRefFilter;
 			$params['__backRef'] = $this->_backRefFilter;
 			DBG::log($params, 'array', '$params __backRef');
 			DBG::log($params, 'array', '$params __backRef');
 		}
 		}
+		if ($this->_childRefFilter) {
+			$params['__childRef'] = $this->_childRefFilter;
+			DBG::log($params, 'array', '$params __childRef');
+		}
 
 
 		$filters = new stdClass();
 		$filters = new stdClass();
 		$filters->currSortCol = $currSortCol;
 		$filters->currSortCol = $currSortCol;