Componette

Componette

contributte

contributte / datagrid-elasticsearch-data-source v2.1.0

๐Ÿ’€ [DEPRECATED] ElasticSearch data source for contributte/datagrid. Use contributte/datagrid.

download-cloud-line composer require ublaboo/datagrid-elasticsearch-data-source

Website ๐Ÿš€ contributte.org | Contact ๐Ÿ‘จ๐Ÿปโ€๐Ÿ’ป f3l1x.io | Twitter ๐Ÿฆ @contributte

Disclaimer

โš ๏ธ This project is no longer being maintained. Please use ublaboo/datagrid.
Composer ublaboo/datagrid-elasticsearch-data-source
Version
PHP
License

Documentation

Usage

<?php

namespace App\Presenters;

use Elasticsearch\Client;
use Nette\Application\UI\Presenter;
use Ublaboo\DataGrid\DataGrid;
use Ublaboo\DatagridElasticsearchDataSource\ElasticsearchDataSource;

final class UsersPresenter extends Presenter
{

	/**
	 * @var ElasticsearchDataSource
	 */
	private $elasticsearchDataSource;


	public function __construct(Client $client)
	{
		$this->elasticsearchDataSource = new ElasticsearchDataSource(
			$client, // Elasticsearch\Client
			'users', // Index name
			'user' // Index type
		);
	}


	public function createComponentUsersGrid(): DataGrid
	{
		$grid = new DataGrid;

		$grid->setDataSource($this->elasticsearchDataSource);

		$grid->addColumnText('id', '#')->setSortable();
		$grid->addColumnLink('nickname', 'Nickname', 'edit')
			->setFilterText();
		$grid->addColumnText('username', 'E-mail (username)')
			->setFilterText();
		$grid->addColumnText('age', 'Age')
			->setSortable()
			->setFilterRange();
		$grid->addColumnText('status', 'Status')
			->setFilterMultiSelect([
				'active' => 'Active',
				'disabled' => 'Disabled',
			]);
		$grid->addColumnDateTime('created', 'Created')
			->setFormat('j. n. Y H:i:s')
			->setFilterDateRange();

		return $grid;
	}
}

Development

This package was maintain by these authors.


Consider to support contributte development team. Also thank you for being used this package.

  • v2.1.0 v2.1.0

    Bump!

    • ElasticsearchDataSource: make ::$searchParamsBuilder protected + 1 mixed arg in SearchParamsBuilder

    Diff: v2.0.1...v2.1.0

  • v2.0.1 v2.0.1

  • v2.0.0 v2.0.0

    BC Breaks:

    • Nette 3.0
  • v1.1.0 v1.1.0

    • Allow custom row factory for search result (thanks @MilanPala)
  • v1.0.0 v1.0.0

    First release

    • Complete ElasticsearchDataSource
    • Complete support class SearchParamsBuilder
    • Tests for SearchParamsBuilder
Componette Componette felix@nette.org