Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Commit

Permalink
Default value setting fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitexus committed May 23, 2019
1 parent c18bfca commit 4d17306
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/FlexiPeeHP/ui/RecordSelector.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,18 @@
*/
class RecordSelector extends \Ease\Html\SelectTag
{

use \Ease\ui\Selectizer;

/**
* Selectize.js based input
*
* @param string $name
* @param array $values
* @param string $value
* @param \FlexiPeeHP\FlexiBeeRO $optionsEngine
* @param array $properties
*/
public function __construct($name, $values, $optionsEngine,
public function __construct($name, $value, $optionsEngine,
$properties = array())
{
if (empty($optionsEngine->getColumnInfo('nazev'))) {
Expand All @@ -40,14 +41,16 @@ public function __construct($name, $values, $optionsEngine,
$keyColumn = 'kod';
}

parent::__construct($name, $values, $properties);
$values = $optionsEngine->getColumnsFromFlexibee([$keyColumn, $nameColumn]);
if ($keyColumn == 'kod') {
foreach ($values as $id => $valueRow) {
$values[$id][$nameColumn] = $values[$id][$keyColumn].': '.$values[$id][$nameColumn];
}
$values = $optionsEngine->getColumnsFromFlexibee([$keyColumn, $nameColumn]);
$options = [];

foreach ($values as $id => $valuesRow) {
$options[$values[$id][$keyColumn]] = $values[$id][$nameColumn];
}

$this->selectize( ['valueField' => $keyColumn, 'labelField' => $nameColumn, 'searchField' => ['kod', 'nazev'], 'create' => false ],$values );

parent::__construct($name, $options, $value, [], $properties);

$this->selectize(['valueField' => $keyColumn, 'labelField' => $nameColumn,
'searchField' => ['kod', 'nazev'], 'create' => false]);
}
}

0 comments on commit 4d17306

Please sign in to comment.