contributte / contributte/datagrid

onRender event

Open
#734 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
296
Forks
215
PR merge metrics
No merged PRs in 30d

Description

Hi @paveljanda, @f3l1x

I have one question, I'm using DataGrid with Doctrine and in one specific case, can not use QueryBuilder and I'm sending data to DataGrid like bellow

$grid->setDataSource($em->getConnection()->fetchAll('my query'));

So, problem is, when I use inline edit, because after edit the row, changes not redraw.

I'm using workaround, than first set empty QueryBuilder and on event onRender set real DataSource, look below

$grid->setDataSource($em->createQueryBuilder());

$grid->onRender[] = function (\Ublaboo\DataGrid\DataGrid $grid): void {
	$grid->setDataSource($em->getConnection()->fetchAll('my query');
};

This is very ugly and not clear, so what you thing about PR, where move call onRender events on start of render method or added new callback with name onBeforeRender?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating DataGrid's render method and the existing onRender event handling mentioned in the issue. Compare the proposed event-timing change with the alternative onBeforeRender callback, then define the expected lifecycle and verify that inline edits using fetchAll data redraw correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.