diff --git a/src/View/Helper/DatatableHelper.php b/src/View/Helper/DatatableHelper.php
index f7b99cb..ba6aa76 100644
--- a/src/View/Helper/DatatableHelper.php
+++ b/src/View/Helper/DatatableHelper.php
@@ -60,10 +60,10 @@ class DatatableHelper extends Helper
];
// @todo change to Text::insert format
- private $columnSearchTemplate = <<');
+ cell.html('');
$(
'input',
$('.filters th').eq($(api.column(colIdx).header()).index())
@@ -147,12 +147,11 @@ class DatatableHelper extends Helper
});
GENERIC_SEARCH_CONFIGURATION;
- // @todo change to Text::insert format
private $columnSearchHeaderTemplate = << {
+ //@todo use configuration for multicolumn filters
:columnSearchTemplate
const dt = $('#:tagId');
@@ -390,12 +390,20 @@ public function getDatatableScript(string $tagId): string
$this->columnSearchTemplate = Text::insert(
$this->columnSearchTemplate,
[
- 'searchTypes' => $this->searchHeadersTypes,
+ 'columnTypes' => ($this->searchHeadersTypes ?: ''),
]
);
- if ($this->getConfig('columnSearch')) {
- $columnSearchTemplate = sprintf($this->columnSearchHeaderTemplate, $tagId, $tagId);
+ if ($this->getConfig('columnSearch'))
+ {
+ $columnSearchTemplate = Text::insert(
+ $this->columnSearchHeaderTemplate,
+ [
+ 'tagId' => $tagId,
+ ]
+
+ );
+ //$columnSearchTemplate = sprintf($this->columnSearchHeaderTemplate, $tagId, $tagId);
} else {
$columnSearchTemplate = '';
}
@@ -453,7 +461,7 @@ protected function validateConfigurationOptions()
*/
protected function processColumnTypeSearch()
{
- $this->setTableTypeSearch($this->Config('searchHeadersType'));
+ $this->setTableTypeSearch($this->getConfig('searchHeadersType'));
if ($this->searchHeadersTypes === null) {
throw new MissConfiguredException(__('Search headers type not configured'));
}
@@ -636,13 +644,12 @@ public function getTableHeaders(
/**
* Put Definition of types of search in headers
*
- * @param iterable|null $tableSearchHeaders - array of search headers
+ * @param array|null $tableSearchHeaders - array of search headers
* @return void
*/
- public function setTableTypeSearch(?iterable $tableSearchHeaders = null): void
+ public function setTableTypeSearch(?array $tableSearchHeaders = null): void
{
-
- if ($tableSearchHeaders === []) {
+ if ($tableSearchHeaders === null) {
$this->searchHeadersTypes = $this->fillDefaulTypes(count($this->dataKeys));
} elseif (count($tableSearchHeaders) != count($this->dataKeys)) {
throw new MissConfiguredException(
@@ -669,13 +676,12 @@ public function getSearchHedadersTypes()
* @param int $count Number of columns in searchable columns
* @return array
*/
- protected function fillDefaulTypes(int $count): array
+ private function fillDefaulTypes(int $count): array
{
$searchTypes = [];
for ($i = 0; $i < $count; $i++) {
$searchTypes[] = ['type' => 'input', 'data' => []];
}
-
return $searchTypes;
}
}