Skip to content

Commit

Permalink
improved example and docs wording
Browse files Browse the repository at this point in the history
  • Loading branch information
dakujem committed Jan 11, 2018
1 parent 0e2833a commit 7e246b3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ The Aim of Slectoo is to be reusable and flexible.
- on-demand (lazy) loading of options using a callback
- options can be loaded asynchronously using AJAX
- options are only loaded when really needed
- can be skinned with other UI libraries or custom scripts (see below)
- can be skinned with UI libraries or custom scripts (see below)
- dependent / cascading inputs


## Notable differences compared to Nette SelectBox & MultiSelectBox

- lazy (callback) options loading
- lazy options loading using a callback
- disabling a Selectoo input does not modify/reset its value, so it can be re-enabled without the loss of the information


Expand Down Expand Up @@ -69,7 +69,7 @@ For best reusability I strongly encourage using factories for inputs with more l
typically these involve fetching data from storage or external resources along with JS/UI configuration,
handling events and value validation.

See examples:
See simple examples:
- [general selectoo factory](examples/factories/Select2SelectooFactory.php)
- [example user select factory](examples/factories/UserSelectooFactory.php)
- [example AJAX API loaded input](examples/ajax/UserAjaxSelectooFactory.php)
Expand Down
5 changes: 3 additions & 2 deletions examples/factories/UserSelectooFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
*/
class Dkj_UserSelectooFactory
{
/** @var Dkj_UserRepository */
private $userRepository;


public function __construct($userRepository)
public function __construct(Dkj_UserRepository $userRepository)
{
$this->userRepository = $userRepository;
}
Expand All @@ -26,7 +27,7 @@ public function __construct($userRepository)
public function create($label = null)
{
$input = new Selectoo($label ?? 'User', function() {
return $this->userRepository->fetchAllUsers(); // returns pairs [ id => name ]
return $this->userRepository->fetchUsers(); // returns pairs [ id => name ]
}, false);

$engine = new Select2Engine();
Expand Down

0 comments on commit 7e246b3

Please sign in to comment.