Git Product home page Git Product logo

kitpagesdatagridbundle's People

Contributors

b-b3rn4rd avatar benjamindulau avatar bghosts avatar dfridrich avatar eliecharra avatar imishchenko avatar jcrombez avatar mfsirameshk avatar mortalflesh avatar p3963 avatar philippe-levan avatar snovichkov avatar tyx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kitpagesdatagridbundle's Issues

Incompatible with your php version 5.6

When I run composer require, I get this message :
[Invalid argument exception]
Package kitpages/data-grid-bundle at version ~3.0 has a PHP requirement incompatible with your PHP version (5.6).

although my PHP version is 7.1

Block kit_grid_tbody_column receives item as an array with full keys

I just upgraded from bundle v1.11.0 to v2.4.2. I had been using the following kind of code (simplified)

{% block kit_grid_tbody_column %}
    {{ item.id }}
{% endblock %}

but now the key "id" is no longer defined. It has been changed to use {{ item["fos_user.id"] }} i.e. the whole key I defined in the query builder and the new Field. Is there a way around this so I could use item.id in the block?

Item list normalizer that uses getResult() hydration

From time to time I keep some display logic inside my entities, since StandardNormalizer hydrates result to array, I have to duplicate logic written in entity or move it to the external file. Like in the example below. It would be handy to a have an option to hydrate result to entity and specify field as property or custom method.

<?php
namespace Kimwild\CommonBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;

class Clients
{
    /* ... */
    public function getFullAddress()
    {
        $return = '';

        if ($this->getAddress()) {
            $return .= $this->getAddress();
        }

        if ($this->getSuburb()) {
            $return .= ' ' . $this->getSuburb() . ', ';
        }

        if ($this->getState()) {
            $return .= $this->getState();
        }

        if ($this->getPostcode()) {
            $return .= ' ' . $this->getPostcode();
        }

        if ($this->getCountry()) {
            $return .= ', ' . $this->getCountry();
        }
         return $return;
    } 
    /* ... */   
}

Getting relations doesn't work

I have this in my controller:

public function indexAction(Request $request) {
    $em = $this->get('doctrine')->getManager();
    $qb = $em->createQueryBuilder()
            ->select('proyecto, centros')
            ->from('PIProyectoBundle:Proyectos', 'proyecto')
            ->leftJoin('proyecto.centros', 'centros');

    $gridConfig = new GridConfig();
    $gridConfig->setCountFieldName('proyecto.id')
            ->addField(new Field('proyecto.nombre', array('label' => 'Nombre', 'filterable' => true, 'sortable' => true)))
            ->addField(new Field('proyecto.estado', array('label' => 'Estado', 'filterable' => true, 'sortable' => true)))
            ->addField(new Field('centros.descripcion', array('label' => 'Cliente', 'filterable' => true, 'sortable' => true)))
            ->addField(new Field('proyecto.pais', array('label' => 'País', 'filterable' => true, 'sortable' => true)));

    $gridManager = $this->get('kitpages_data_grid.manager');
    $grid = $gridManager->getGrid($qb, $gridConfig, $this->getRequest());

    return $this->render('PICommonBundle:Default:index.html.twig', array('grid' => $grid));
}

And this is the related Entity:

<?php

namespace PI\ProyectoBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Event\LifecycleEventArgs;

/**
 * @ORM\Entity
 * @ORM\Table(name="proyectos")
 * @ORM\HasLifecycleCallbacks
 */
class Proyectos {

    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     */
    protected $id;

    /**
     * @ORM\Column(type="string", length=45, unique=true, nullable=false)
     */
    protected $nombre;

    /**
     * @ORM\Column(type="boolean", nullable=true)
     */
    protected $estado;

    /**
     * @ORM\Column(type="string", length=45, nullable=false)
     */
    protected $pais;

    /**
     * @ORM\Id
     * @ORM\ManyToOne(targetEntity="PI\ClienteBundle\Entity\Clientes", cascade={"all"})
     * @ORM\JoinColumn(name="cliente", referencedColumnName="id")
     */
    protected $clientes;

    /**
     * @ORM\ManyToMany(targetEntity="PI\CentroBundle\Entity\Centros", inversedBy="proyectos", cascade={"persist"})
     * @ORM\JoinTable(name="proyectos_has_centros",
     *      joinColumns={@ORM\JoinColumn(name="proyectos_id", referencedColumnName="id"),
     *                   @ORM\JoinColumn(name="proyectos_cliente", referencedColumnName="cliente")},
     *      inverseJoinColumns={@ORM\JoinColumn(name="centros_id", referencedColumnName="id")}
     *      )
     */
    protected $centros;

    /**
     * @ORM\ManyToMany(targetEntity="Application\Sonata\UserBundle\Entity\User", cascade={"persist"})
     * @ORM\JoinTable(name="proyectos_has_system_user",
     *      joinColumns={@ORM\JoinColumn(name="proyectos_id", referencedColumnName="id"),
     *                   @ORM\JoinColumn(name="proyectos_cliente", referencedColumnName="cliente")},
     *      inverseJoinColumns={@ORM\JoinColumn(name="system_user_id", referencedColumnName="id")}
     *      )
     */
    protected $ingenieros;

    public function __construct() {
        $this->centros = new \Doctrine\Common\Collections\ArrayCollection();
        $this->ingenieros = new \Doctrine\Common\Collections\ArrayCollection();
    }

    public function getId() {
        return $this->id;
    }

    public function setNombre($nombre) {
        $this->nombre = $nombre;
    }

    public function getNombre() {
        return $this->nombre;
    }

    public function setEstado($estado) {
        $this->estado = $estado;
    }

    public function getEstado() {
        return $this->estado;
    }

    public function setPais($pais) {
        $this->pais = $pais;
    }

    public function getPais() {
        return $this->pais;
    }

    public function setClientes(\PI\ClienteBundle\Entity\Clientes $clientes) {
        $this->clientes = $clientes;
    }

    public function getClientes() {
        return $this->clientes;
    }

    public function setCentros(\PI\CentroBundle\Entity\Centros $centros) {
        $this->centros[] = $centros;
    }

    public function getCentros() {
        return $this->centros;
    }

    public function setIngenieros(\BIT\UserBundle\Entity\User $ingenieros) {
        $this->ingenieros[] = $ingenieros;
    }

    public function getIngenieros() {
        return $this->ingenieros;
    }

    /**
     * @ORM\PrePersist
     */
    public function prePersist(LifecycleEventArgs $eventArgs) {
        $em = $eventArgs->getEntityManager();
        $q = $em->createQuery('SELECT MAX(p.id) FROM PIProyectoBundle:Proyectos p');
        $id = $q->getSingleResult(\Doctrine\ORM\Query::HYDRATE_SINGLE_SCALAR);
        $this->id = $id + 1;
    }

}

But I get this error while try to display the datagrid:

An exception has been thrown during the rendering of a template
("key=descripcion (origin=centros.descripcion) not found in array=Array
(
[0] => Array
(
[id] => 1
[descripcion] => Centro 1
)

)
") in KitpagesDataGridBundle:Grid:grid.html.twig at line 62.

How I can fix that? Is there any way to get clientes, centros and ingenieros in the same DataGrid and apply the same filters and sort?

Normalizer

Version : v2.4.0

When using a group by, item normalizer create a sub array for associated objects.

$queryBuilder->select('offer, partner, count(s.id) as subscriptionCount')
        ->from('Offer', 'offer')
        ->innerJoin('offer.partner', 'partner')
        ->leftJoin('offer.subscriptionList', 's', Expr\Join::WITH, 's.offer = offer.id')
        ->groupBy('offer.id');

Actual :

  "offer.id" => 1572
  "offer.partner" => array:8 [
    "name" => "Test Partner"
    "id" => 68
  ]

Expected :

  "offer.id" => 1572
  "partner.name" => "Test Partner",
  "partner.id" => 68
  ]

Events Documentation

Hi,

The code in kitpages_data_grid.on_apply_filter example have some typo error about $gridQueryBuilder.

Still in this doc, kitpages_data_grid.on_apply_selector is not documented.

In doc/10-GridExtendedUse.md#render-the-item-value-with-a-twig-templat, i had to modify

return $twig->render("AppSiteBundle:Default:grid-element.html.twig", $row);

return $twig->render("AppSiteBundle:Default:grid-element.html.twig", array("row" => $row, 'value' => $value));

Thanks for your bundle, it help me a lot :)

Guldil

Incompatible with Symfony 3.1.1

I'm unable to install the bundle on the latest stable version of Symfony.

composer require kitpages/data-grid-bundle                                       
Using version ^2.5 for kitpages/data-grid-bundle
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Conclusion: remove symfony/symfony v3.1.1
    - Conclusion: don't install symfony/symfony v3.1.1
    - kitpages/data-grid-bundle 2.5.2 requires symfony/twig-bundle ~2.3 -> satisfiable by symfony/twig-bundle[v2.3.0, v2.3.1, v2.3.10, v2.3.11, v2.3.12, v2.3.13, v2.3.14, v2.3.15, v2.3.16, v2.3.17, v2.3.18, v2.3.19, v2.3.2, v2.3.20, v2.3.21, v2.3.22, v2.3.23, v2.3.24, v2.3.25, v2.3.26, v2.3.27, v2.3.28, v2.3.29, v2.3.3, v2.3.30, v2.3.31, v2.3.32, v2.3.33, v2.3.34, v2.3.35, v2.3.36, v2.3.37, v2.3.38, v2.3.39, v2.3.4, v2.3.40, v2.3.41, v2.3.42, v2.3.5, v2.3.6, v2.3.7, v2.3.8, v2.3.9, v2.4.0, v2.4.1, v2.4.10, v2.4.2, v2.4.3, v2.4.4, v2.4.5, v2.4.6, v2.4.7, v2.4.8, v2.4.9, v2.5.0, v2.5.1, v2.5.10, v2.5.11, v2.5.12, v2.5.2, v2.5.3, v2.5.4, v2.5.5, v2.5.6, v2.5.7, v2.5.8, v2.5.9, v2.6.0, v2.6.1, v2.6.10, v2.6.11, v2.6.12, v2.6.13, v2.6.2, v2.6.3, v2.6.4, v2.6.5, v2.6.6, v2.6.7, v2.6.8, v2.6.9, v2.7.0, v2.7.1, v2.7.10, v2.7.11, v2.7.12, v2.7.13, v2.7.14, v2.7.2, v2.7.3, v2.7.4, v2.7.5, v2.7.6, v2.7.7, v2.7.8, v2.7.9, v2.8.0, v2.8.1, v2.8.2, v2.8.3, v2.8.4, v2.8.5, v2.8.6, v2.8.7].

Working with results from DB

Hi, this is not an issue but a question around how to use values coming from DB. This is the code I'm using to get and build the DataGrid component:

    $repository = $this->getDoctrine()->getRepository('PIProyectoBundle:Proyectos');
    $qb = $repository->createQueryBuilder('p');

    $gridConfig = new GridConfig();
    $gridConfig->setCountFieldName('p.id')
            ->addField(new Field('p.nombre', array('label' => 'Nombre', 'filterable' => true, 'sortable' => true)))
            ->addField(new Field('p.estado', array('label' => 'Estado', 'filterable' => true, 'sortable' => true)))
            ->addField(new Field('p.pais', array('label' => 'País', 'filterable' => true, 'sortable' => true)));

    $gridManager = $this->get('kitpages_data_grid.manager');
    $grid = $gridManager->getGrid($qb, $gridConfig, $this->getRequest());

    return $this->render('PIProyectoBundle:Default:index.html.twig', array('grid' => $grid));

That works fine. Now in my DB I have a column that hold numeric values like 0 or 1, when I display that data using the component I get 0 or 1 but I want those values to be No if is 0 and Yes if is 1, how?

Retrieve id variable in Twig

Hello

i've got a querybuilder with several jointures i want to present through KitpagesDataGridBundle. It works well, unfortunatly, when i try to add an action column i'm not able to retrieve an id value from my querybuilder.
I tried a lot of possibilities of naming but nothing works.

Here my controller code :
queryBuilder = $em->createQueryBuilder()
->select('l, m, c')
->from('NurunRhBundle:ConseillerMandat', 'l')
->leftJoin('l.conseiller', 'c')
->leftJoin('l.mandat', 'm')
->where('l.dateFin BETWEEN :datedeb AND :datefin')
->add('orderBy', 'l.dateFin DESC')
->setParameter('datefin', $datefin->format('Y-m-d'))
->setParameter('datedeb', $datedeb->format('Y-m-d'))
;

$gridConfig = new GridConfig();
$gridConfig
        ->setQueryBuilder($queryBuilder)
        ->setCountFieldName("l.id")
        ->addField(new Field('l.id', array('visible' => false)))
        ->addField(new Field('c.prenom', array('label' => 'Prénom', 'filterable' => true)))
        ->addField(new Field('c.nom', array('label' => 'Nom', 'filterable' => true)))
        ->addField(new Field('m.identifiant', array('label' => 'Mandat', 'filterable' => true)))
        ->addField(new Field('l.dateFin', array('label' => 'Date de fin', 'filterable' => true)))
    ;

Here my view code :
{% embed kitpages_data_grid.grid.default_twig with {'grid': grid} %}
{% block kit_grid_thead_column %}
Action
{% endblock %}

        {% block kit_grid_tbody_column %}
            <td><a href="{{ path ("nurun_affectation_view", {"id": l.id}) }}">Edit</a></td>
        {% endblock %}
    {% endembed %}

I've got error message : Variable "l" does not exist in NurunRhBundle:ConseillerMandat:index.html.twig at line 26

Thank's a lot for your help !
Cedric.

Filter and Sort for concatenation of two fields, firstname. ' '. lastname

Hello,

How can I make it happen, the sort works for both fields.
please see the code below:

            ->addField('o.firstname', array('filterable' => true, 'sortable' => true, 'label' => 'Customer',
                'formatValueCallback' => function ($value, $row) {
                    return $row['o.firstname'] . ' ' . $row['o.lastname'];
                }
            ))

I tried to add customization to the event listener:

    public function onApplyFilter(DataGridEvent $event)
    {
        // data available
        $queryBuilder = $event->get("gridQueryBuilder");
        $grid = $event->get("grid");
        $filter = $event->get("filter");

        // operation (this is de default behavior, you can code your's here instead)
        $fieldList = $grid->getGridConfig()->getFieldList();
        $filterRequestList = array();
        foreach($fieldList as $field) {
            if ($field->getFilterable()) {
              if ($field == 'o.firstname' ) {
                    $filterRequestList[] = $queryBuilder->expr()->like("concat(o.firstname, ' ', o.lastname)", ":filter");
                }

                $filterRequestList[] = $queryBuilder->expr()->like($field->getFieldName(), ":filter");
            }
        }
        if (count($filterRequestList) > 0) {
            $reflectionMethod = new \ReflectionMethod($queryBuilder->expr(), "orx");
            $queryBuilder->andWhere($reflectionMethod->invokeArgs($queryBuilder->expr(), $filterRequestList));
            $queryBuilder->setParameter("filter", "%".$filter."%");
        }
        $grid->setFilterValue($filter);

        // cancel default behavior
        $event->preventDefault();
    }

Connecting LexikForm Filter with Kitpages datagrid

When I build a query as follows
$repository = $this->getDoctrine()->getRepository('provestaulesBundle:persona');
$queryBuilder = $repository->createQueryBuilder('persona');

I get the following error:
An exception has been thrown during the rendering of a template ("Warning: rawurlencode() expects parameter 1 to be string, array given in /home/marcel/neo/proves/NEOproves2.3/vendor/kitpages/data-grid-bundle/Kitpages/DataGridBundle/Tool/UrlTool.php line 40"

When this will be working I would like to add:
$this->get('lexik_form_filter.query_builder_updater')->addFilterConditions($form, $queryBuilder);
so I can use a query build with LexikForm Builder.
Thanks,

Marcel

Key "id" for array with key in twig

Key "id" for array with keys "item.id, item.name, item.email, item.city, item.birthDate" does not exist in JonyBootBundle:Boot:index.html.twig at line 25

this is my error i followed your documentation but still this error.

It's not possible to filter non-ascii characters

Not sure if non-ascii or multibyte characters is the correct term, but when trying to filter using the term "löf", which should return data, the query string looks like this: kitdg_grid_grid_filter=l%F6f and in the filter input field the ö is a strange unknown character (diamond with question mark in it). No data is found.

I am using symfony 2.2.1 and the current dev-master version of the bundle (1.9.0 i believe).

Add a debug system

A debug system is needed. We are blind when we are using this bundle...

select and do action

I just want to ask if there is any function of KitpagesDataGridBundle that allows users to select specified dispalyed data and do actions like delete the row?
Thanks

Sort and filter for fields takes from outside the entity, take values via service

Hello,
I have the case of having fields from outside the Entity. and I'm not able to make the sort and filter works for these fields.

and these fields take its value from a service.
I thought about adding them to the entity, but since the Entity should be simple and should not use services inside, I didn't.

Can you help me with that ?


->addField('dueDate', array('filterable' => true, 'sortable' => true, 'label' => 'Due Date',
                'formatValueCallback' => function ($value, $row) {
                    /** @var AbstractPaymentProvider $paymentProvider */
                    $paymentProvider = $this->get('payment.factory')->factoryByPaymentProvider($row['p.paymentProvider']);
                    /** @var  Order $order */
                    $order = $this->get('doctrine')->getRepository('CommonBundle:Order')->find($row['o.id']);
                    return $paymentProvider->getPaymentProviderName() != 'paypal' ? $paymentProvider->getDueDate($order)->format('Y-m-d') : '-';
                }
            ))
 ->addField('invoiceDate', array('filterable' => true, 'sortable' => true, 'label' => 'Invoice Date',
                'formatValueCallback' => function ($value, $row) {
                    if ($row['o.dateMoving']) {
                        return $row['o.dateMoving']->add(new \DateInterval('P3D'))->format('Y-m-d');
                    }
                }
            ))

How to switch normalizer to legacy?

Hi,

I have User one to many Order entities and my query has proper join which returns list of users with nested array of all his orders. I saw that when I change kitpages_data_grid.item_list_normalizer.standard to kitpages_data_grid.item_list_normalizer.legacy in kitpages_data_grid.grid_manager service its returning what I want. My question is how can I change this normalizer?

Change on the fly paginator ?

Hy,

Is there an easy way to create a combobox with paginator count item like 10 / 50 / All ?

I'm looking around $paginatorConfig = $gridConfig->getPaginatorConfig()->setItemCountInPage(10); but it's not working.

Thanks

Guldil

Sorting with multiple columns for the same field

There seems to be a bug with sorting when there are multiple columns for the same field. Example, my entity has a date field for which I create two columns. One column for the week number and one column for the full date:

$config
    ->addField(new Field('d.date', [
        'label' => 'Week',
        'formatValueCallback' => function ($value) {
            return $value instanceof \DateTime ? $value->format('W') : $value;
        },
    ]))
    ->addField(new Field('d.date', [
        'label' => 'Date',
        'sortable' => true,
        'formatValueCallback' => function ($value) {
            return $value instanceof \DateTime ? $value->format('Y-m-d') : $value;
        },
    ]))
;

This config makes the Date column not properly sortable. Sorting ASC works, but DESC not. The URL for the column header is improperly generated. The issue seems to be in GridManager->applySort. It checks field names instead of the actual column fields, and it stops after the first march (using break). So, it finds the first date column in my config, sees that it is not sortable and then skips all other columns. So it misses the second date column which is sortable.

Following semver.org

Hello,

In order to avoid repeating "no bc break" or lose people when there is bcb, you can follow semver.org. When you bcb, it's obvious because you do a new major version :) .

Separate javascript code from <script> tags

Hi, this is a suggested enhancement to the next update.

I'm using head.js to asynchronously load javascript libraries. This means that jquery will load for me after the data grid's (function())() executes resulting in an error "$ is not defined" and breaking the filter buttons' functionality.

Could it be possible to separate the javascript code from the script tags so that I could wrap the code in something like:

head.ready('jquery', function() {
    {{ parent() }}
});

Curretly it's difficult to wrap the head.ready code since the script tag will be included in parent().

Method addField of GridConfig class missing argument for tag list

Documentation states that you can add tags to a field by:

$gridConfig->addField("foo", [], ['myTag', 'foo']);

but the addField implementation is missing the third parameter. Fix should be simple.

As an alternative while fix is not in you can add tags by instantiating the Field yourself:

$field = new Field("foo", [], ['myTag', 'foo']);
$gridConfig->addField($field);

Multiple filters

Hi, could it be possible to have an option to set multiple filters on each field tagged as 'filterable' ?

For example :
->addField(new Field('facture.label', array('sortable'=>true,'filterable' => true, 'label'=>'Label')))
->addField(new Field('facture.amount', array('sortable'=>true,'filterable' => true,'label'=>'Amount)))

=> Two INPUT fields, Label, and Amount, and filter for each one.

problem when use standalone paginator

I'm trying to use the bundle to make the paginetion with my custom grid.
I'm following the example that you suggest for standalone paginator:
https://github.com/kitpages/KitpagesDataGridBundle/blob/master/Resources/doc/20-StandalonePaginator.md
but my script return an error when my controller execute this line:
$paginator = $gridManager->getPaginator($paginatorConfig, $this->getRequest());
The error is: Attempted to call method "getPaginator" on class "Kitpages\DataGridBundle\Grid\GridManager"
It seems that the class not has the method getPaginetor; ineed when I check the code of the class in your bundle, the method non exist.
I ask you if there is a mistake in the example code.
Thank you in advance for the answer.

Compatibility problem with hydrateRowData()

Hi

i just updated my symfony project with this versions

  • Symfony : 2.5.11
  • Doctrine/orm : 2,5,0
  • Kitpages : master

Runtime Notice: Declaration of Kitpages\DataGridBundle\Hydrators\DataGridHydrator::hydrateRowData() should be compatible with Doctrine\ORM\Internal\Hydration\AbstractHydrator::hydrateRowData(array $data, array &$result) in /home/cedric/Programmation/kentel/trunk/vendor/kitpages/data-grid-bundle/Kitpages/DataGridBundle/Hydrators/DataGridHydrator.php line 0

It was functionnal before update.

Any idea ?

wrong condition in normalization loop

hello,

i just installed an last version of symfony 2.1 with kitpages/data-grid-bundle ( v1.6.0 ) and there is too simple condition in service GridManager.

You wrote:

// normalize result (for request of type $queryBuilder->select("item, bp, item.id * 3 as titi"); )
    $normalizedItemList = array();

    foreach ($itemList as $item) {
        $normalizedItem = array();
        foreach ($item as $key => $val) {
            if (is_int($key)) {
                foreach ($val as $newKey => $newVal) {
                    $normalizedItem[$newKey] = $newVal;
                }
            } else {
                $normalizedItem[$key] = $val;
            }
        }
        $normalizedItemList[] = $normalizedItem;
    }

But in my opinion You should add one more condition in :

if (is_int($key)) {

and change it into:

if (is_int($key) && is_array($val)) {

because doctrine can return result like:

[0] => Array
            (
                [id] => 82
                [name] => Przypomnienie 
                [subject] => 
                [message] => Witaj, 
                [smsMessage] => Witaj, 
                [type] => 1
                [intervalValue] => 24
                [intervalType] => hours
                [template] => 1
                [active] => 1
                [created] => DateTime Object
                    (
                        [date] => 2013-04-28 13:01:55
                        [timezone_type] => 3
                        [timezone] => Europe/Berlin
                    )

                [updated] => DateTime Object
                    (
                        [date] => 2013-04-28 13:02:04
                        [timezone_type] => 3
                        [timezone] => Europe/Berlin
                    )

            )

        [1] => 82
        [intervals] => 1
    )

in row:

[1]=>82 , 

Your first condition will return true but when Your code try to run foreach like on array it will return an error.

Best regards,
Łukasz

How to get the total items count ?

Hello,
do you have a 'getTotalItemCount' that I can show the total number or grid rows ?

I want to show it like this:

 {# total items count #}
    <div class="count">
        Total items Count: {{ grid.getTotalItemCount }}
    </div>

Non case sensitive filter search

There is possible in te config of the grid that the filter can be non sensitive, because I have the issue that with the word "Julien" get the results but with 'julien' no.

Here is my gridConfig:

$gridConfig
->setCountFieldName('Authors.id')
->addField(new Field('Authors.cover_image_id',
    array(
        'label' => 'Image',
        'filterable' => false,
        'sortable' => true,
        'autoEscape' => true,
        'formatValueCallback' => function ($value) {
            return 'image_field';
        },
    )))
->addField(new Field('Authors.name', array('label' => 'Name', 'filterable' => true, 'sortable' => true)));

There is some extra config that I have to apply?

Thanks.

Suggestion: add row class block

I reckon it would be useful to be able to specify a class for a table row.
Probably the simplest solution would be to add an empty block to the grid template and extend it only if required.
For example

{% embed kitpages_data_grid.grid.default_twig with {'grid': grid} %}
    {% block row_class %}
        {% if item['t.deletedAt'] %} stroke {% endif %}
    {% endblock %}

v3.0+ via composer PHP7.1+ requirement ?

Is the PHP7.1+ requirement mandatory for 3.0+ versions ? (when installed with composer)

One major production platform is Ubuntu 16.04LTS that provides PHP 7.0. Having a strong requirement on PHP7.1+ if not really needed prevents the use of Symfony 3.4 (LTS) like platform and would require 4.4 LTS version (probably on Ubuntu 18.04LTS -> PHP7.2) which would make a huge step when migrating ...

If not completely needed or if avoidable you should provide a PHP7.0 compatible version for Symfony 3.4 LTS (= data-grid-bundle v3.x)

Thanks !

Changing the filter buttons' translated text.

The data grid's filter buttons in {% block kit_grid_filter %} have {{ "Apply"|trans }} and {{ "Filter"|trans }}

Any possibility of being able to change those texts to {{ 'mygridpage.filter.label.apply'|trans }} and {{ 'mygridpage.filter.label.filter'|trans }} in future releases?

.git directory is missing

When I try to update dev-master in composer
"Updating kitpages/data-grid-bundle dev-master (1271e03 => 60969cf)"
I get an exception:

[RuntimeException]
The .git directory is missing from /var/www/html/myproject/vendor/kitpages/data-grid-bundle/Kitpages/DataGridBundle

one-to-many field

Its possible to searching in one-to-many (one item has many authors) field ?

Im trying something like this:

    public function indexAction(Request $request)
    {
        $queryBuilder = $this->em->createQueryBuilder()
            ->select('i, a')
            ->from('\Acme\AcmeBundle\Entity\ItemEntity', 'i')
            ->where('i INSTANCE OF \Acme\AcmeBundle\Entity\AlbumEntity')
            ->innerJoin('i.authors', 'a');

        $gridConfig = new GridConfig();
        $gridConfig
            ->setCountFieldName('i.id')
            ->addField(new Field('i.authors', [
                    'filterable'          => true,
                    'formatValueCallback' => function ($authors) {

                        $author_names = [];
                        foreach ($authors as $author) {
                            $author_names[] = $author['name'];

                        }
                        return implode(',', $author_names);

                    }
                ])
            )
            ->addField(new Field('i.name', ['filterable' => true]));

        $grid = $this->managerGrid->getGrid($queryBuilder, $gridConfig, $request);

        return [
            'grid' => $grid
        ];
    }

its displayed correctly, but searching not working:

[1/2] QueryException: SELECT count(DISTINCT i.id) FROM \Acme\AcmeBundle\Entity\ItemEntity i INNER JOIN i.authors a WHERE i INSTANCE OF \Acme\AcmeBundle\Entity\AlbumEntity AND (i.authors LIKE :filter OR i.name LIKE :filter)

[2/2] QueryException: [Semantical Error] line 0, col 180 near 'authors LIKE': Error: Invalid PathExpression. Must be a StateFieldPathExpression.

generated query is of course bad.. im tried also i.authors.name, a.name.. its this possible ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.