nextras / datagrid Goto Github PK
View Code? Open in Web Editor NEWNextras Datagrid component for Nette Framework.
Home Page: http://nextras.org/datagrid
License: MIT License
Nextras Datagrid component for Nette Framework.
Home Page: http://nextras.org/datagrid
License: MIT License
If you use globalActions and filter, the data grid loads with filter is not correct one, as first load of data is in globalActions, but filter is not loaded (not grab data to $this->filter), so data is loaded with no filter, on second getData with correct filter values is data already loaded, so the load is skipped.
Nette\Application\UI\Control::invalidateControl() is deprecated; use $this->redrawControl($snippet) instead.
po kliknuti na tlacitko edit by sa mohol prvy input focusnut.
dakujem
v Neo4j sa stava ze Noda ma id = 0, avsak datagridu sa to moc napaci :(
Unable to use Nextras/Datagrid with development version of Nette Framefork.
Your requirements could not be resolved to an installable set of packages.
Problem 1
- nextras/datagrid 3.0.x-dev requires nette/application ~2.4 -> satisfiable by nette/application[v2.4.x-dev].
- nextras/datagrid v3.0.0 requires nette/application ~2.4 -> satisfiable by nette/application[v2.4.x-dev].
- nextras/datagrid v3.0.0-beta1 requires nette/application ~2.4 -> satisfiable by nette/application[v2.4.x-dev].
- nextras/datagrid v3.0.0-rc1 requires nette/application ~2.4 -> satisfiable by nette/application[v2.4.x-dev].
- nextras/datagrid v3.0.0-rc2 requires nette/application ~2.4 -> satisfiable by nette/application[v2.4.x-dev].
- nextras/datagrid v3.0.1 requires nette/application ~2.4 -> satisfiable by nette/application[v2.4.x-dev].
- nextras/datagrid v3.0.x-dev requires nette/application ~2.4 -> satisfiable by nette/application[v2.4.x-dev].
- Conclusion: don't install nette/application v2.4.x-dev
- Installation request for nextras/datagrid ^3.0@dev -> satisfiable by nextras/datagrid[v3.0.x-dev, v3.0.0, v3.0.0-beta1, v3.0.0-rc1, v3.0.0-rc2, v3.0.1].
Installation failed, reverting ./composer.json to its original content.
Template file name was not specified.
https://github.com/nextras/datagrid/blob/master/Nextras/Datagrid/Datagrid.latte#L11
Datagrid supports inline editing, but if you want another action, you have to code it by yourself.
I think that 2 basic actions are edit and delete.
What do you think?
Hi,
i want save state grid to session
This is $grid->setRememberState(true); command for other grid o5/grido. Where i used on my project.
People is on page 5. He click on the link. He want return back. Ups Page 1, sort default ...
I solve problem in my own code. Without update grid. Under my opinion, the grid should be able to store session state.
Do you can create pull request?
PS:
( sorry for my bad english )
$this->blockQueue
was removed in new version of latte: https://github.com/nette/latte/releases
This results in row action column not being displayed as condition isset($this->blockQueue["row-actions"])
in Datagrid.latte
is always false.
It seems that using $this->hasBlock("row-actions")
in Datagrid.latte
works fine - see pull request #101 🙂
Component with name 'filter' does not exist.
https://github.com/nextras/datagrid/blob/master/Nextras/Datagrid/Datagrid.php#L183
After update to Nette 2.4, grid generate deprecated notice:
Accessing methods as properties via $obj->processForm is deprecated in PATH\vendor\nextras\datagrid\src\Datagrid.php:462
diky https://github.com/nextras/datagrid/blob/master/Nextras/Datagrid/Datagrid.php#L434 by se hodilo v dokumentaci zverejnit 5.4+ nemam pravdu? a stranky nextras.cz uz par dni nefrci. diky za pozornost
Proč při stránkování dochází k přesměrování, chápu že je tam parametr do, ale nešlo by jen předávat parametr, respetive není to zbytečné?
The filter values are passed to datasource callback even the form is invalid. It can be problem when sanitized value is expected, let's say MAC or IP address. Not sure how to change the behaviour, maybe do not redirect and do not pass filter values.
At least for checkboxes, but I think even for text inputs it gives a sense (or I'm missing a reason why not).
If you agree I will send a pull request.
Do gridu som nepridal ziedny button (ani neviem ci sa to da) a ani som nedefinoval callback na edit form a predsa mam na konci riadku edit link
V případě, že primary key nabývá hodnoty == NULL a není definován editační formulář tak dochází k pádu program na neexistujícíc komponentě edit.
viz. https://github.com/nextras/datagrid/blob/master/Nextras/Datagrid/Datagrid.latte#L93
Řešením by teoreticky mohlo být přidání třech rovnítek.
Accessing methods as properties via $obj->processForm is deprecated in C:\xampp\htdocs\NETTE2.4\vendor\nextras\datagrid\src\Datagrid.php:462
aby sa grid mohol prekladat...
I tested Live demo and filter does not work for me. If I do "onBlur" or I click on Filter button - nothing happens. I did not find any javascript error. Is it broken?
(tested on Win7 64bit and Firefox 23.0.1)
Moznost pridat vlastnu classu / attributy pre jednotlive riadky
c1e62b3 throws invalid callback exception, when translator isn't explicitly provided on Nette v2.0.12 (master is fine)
tracy:
https://dl.dropboxusercontent.com/u/80163114/datagrid-exception.htm
Ahoj,
potřeboval bych nastavit defaultní řazení a aby uživatel měl možnost ho měnit.
Pokud nastavim default ordering, nelze již uživatelsky měnit řazení ASC/DESC
$grid->addColumn('objednavka_uid', 'Číslo')->enableSort($grid::ORDER_DESC);
bez default orderingu uživatelská změna řazení ASC/DESC funguje pěkně.
$grid->addColumn('objednavka_uid', 'Číslo')->enableSort();
Dá se to nějak řešit? Díky. Honza
Just about anything lights the screen red with deprecation errors. PHP 7.
I have grid without filter but with row-actions block in my template.
Inside Datagrid.latte:
{var $hasActionsColumn =
isset($this->blocks['row-actions']) ||
isset($this->blocks['global-actions']) ||
isset($form['filter']) ||
(bool) $control->getEditFormFactory()
}
When dumped $this->blocks the row-actions is missing. If I create filter form, than $hasActionsColumn will be true (not from row-actions block existence) and I can see all row-actions. Without filter not.
Possibly $this->blocks cannot see MY row-actions but only default blocks in Datagrid.latte?
Hi guys, first of all, thanks for this project, it's awesome and we use it often at Vcelka.cz ;)
Now, I think in previous versions the datagrid used to behave differently in regard to editting. When I used edit, all rows remained, but the edited was changed to inputs. Then after cancelling, the whole datagrid remained the same. However, with this version (e.g. here) when I select edit, all the other rows disappear, and remain gone even when I cancel the action, which I think is a bug. If not, then what was the idea behind that?
I would love to help fixing this, but I am not very good with ajax and partial snippet redrawing..
Zdravím,
Bolo by možné odstrániť automatické vytváranie premennej $cell pri vlastnom vykresľovaní bunky?
Pracujem s Doctrine a keďže výstup pre jeden riadok môže vyzerať aj takto:
http://forum.nette.org/cs/22758-doctrine-kdyby-doctrine-queryobject-vytiahnutie-dat-do-gridu
Datagrid sa pokúsi vyhľadať premennú, no nenájde a vyhlási chybu. Pritom mne by úplne stačilo si tú premennú nájsť sám, pokiaľ si vytváram vlastné vykresľovanie.
Bolo by to možné toto upraviť (napr. aspoň jej vytvorenie podmieniť)?
{var $cell = isset($row[$column]) ? $row[$column] : NULL}
Tým by bola udržaná spätná kompatibilita a zároveň pridaná voľnosť si vo výslednom rendery nájsť premennú v $row.
If you have default sort in column by DESC, like below
$grid->addColumn("revision","Revize")->enableSort($grid::ORDER_DESC);
data in grid table sorted are OK, but link for change sort from DESC to ASC is without function
Hi, labels on submit buttons 'filter' and 'cancel' in filter form are being translated twice - manually in the form and then automatically when rendering. I guess
#437: $form['filter']->addSubmit('filter', $this->translate('Filter'));
#440: $form['filter']->addSubmit('cancel', $this->translate('Cancel'));
should be
$form['filter']->addSubmit('filter', 'Filter');
$form['filter']->addSubmit('cancel', 'Cancel');
in Datagrid.php
Zdravím,
bolo by možné pridať možnosť nastaviť primary key ako callback?
Pracujem s Doctrine a keďže výstup pre jeden riadok môže vyzerať aj takto:
http://forum.nette.org/cs/22758-doctrine-kdyby-doctrine-queryobject-vytiahnutie-dat-do-gridu
potreboval by som tam dať takýto callback:
$datagrid->setRowPrimaryKey(function($row)
{
return $row[0]->getId();
});
Bolo by to možné pridať?
Is there easy way, to perform global action only on selected rows (via checkbox)?
if I use $.nette.ajax call for something else while having nextras.datagrid.js in project, following code gets executed
before: function(xhr, settings) {
this.grid = settings.nette.el.parents('.grid');
},
and it ends up with error
Uncaught TypeError: Cannot read property 'el' of undefined
I believe that it should be considered that settings.nette.el does not have to exist?
Im having some problem with dependencies. Your library says, it needs at leats php 7.2.
Problem 1
- nextras/datagrid v3.1.0 requires php >=7.2 -> your PHP version (7.1.30) overridden by "config.platform.php" version (7.1) does not satisfy that requirement.
- nextras/datagrid v3.1.0 requires php >=7.2 -> your PHP version (7.1.30) overridden by "config.platform.php" version (7.1) does not satisfy that requirement.
- nextras/datagrid v3.1.0 requires php >=7.2 -> your PHP version (7.1.30) overridden by "config.platform.php" version (7.1) does not satisfy that requirement.
- Installation request for nextras/datagrid ^3.1 -> satisfiable by nextras/datagrid[v3.1.0].
However, library with version v3.1.0
works great even on 7.1.
Is it possible to lower the demanding version to 7.1 in your composer.json
?
Narazil jsem na problem, kde mam nastaveny filtr na urcity sloupec a upravim data ve sloupci, ktere neodpovidaji filtru, grid mi pada na vyjimce "Row not found"
Vysvetlim na prikladu, kdyz nastavim filtr presne na obsah bunky a tu hodnotu te dane bunky prepisu treba z "bbbbbbbbbb " na "aaaaaaa" nove odeslana data se ulozi, ale nezmizi vyber editace a aplikace spadne na jiz zminene vyjimce, viz tabulka nize
+----------------+-----------------+------------
| nenastaven_ | bbbbbbbbbb | filtr
+----------------+-----------------+------------
| sloupecek_1 | sloupecek_2 | header
+----------------+-----------------+------------
| aaaaaaaaa | bbbbbbbbbbb | ID_1_
+----------------+-----------------+------------
| cccccccccc | bbbbbbbbbbb | ID_2
+----------------+-----------------+------------
Misto Nette database pouzivam dibi
Verze Nette mam 2.1.2.
Při změně filtrování (a nejspíš i při zrušení filtru) by to chtělo nastavit aktuální stránku na 1. Může se totiž stát, že aktuální stránka bude vyšší, než maximální stránka pro daná filtrovací kritéria. Renderování paginačního panelu pak v případě, kdy nejsou nalezeny vůbec žádné záznamy, navíc vykazuje podivné chování (tváří se např., že aktuální stránka je 1, ačkoliv není, a přepnutí na 1. stránku přes tento panel potom ani nefunguje).
Hi,
I would like to redirect somewhere (page with complex form, ...) from globalAction with current id selection. What is best practice for this. There is there problem with full ajax form now.
Thank you.
po af850cd#diff-212f13d14ab66592db3ead0e9e23d060R281 mne skace pri pouziti strankovani vzdy na prvni stranku.
pr:
//$this->paginator->page ==1
//$this->page ==2
$this->paginator->setItemCount($itemsCount);
if ($this->paginator->page !== $this->page) {
$this->paginator->page = $this->page = 1;
}
//zde ocekavam $this->paginator->page == $this->page ==2 ale dostavam 1
problem resim zmenou radku https://github.com/nextras/datagrid/blob/master/src/Datagrid.php#L339 na
$this->paginator->page = $this->page? : 1
Hi,
When a primary key has a value that loosely equals to NULL(like 0 does), the grid template always tries to render edit form.
Datagrid.latte
{define row-inner}
...
{var $editRow = $editRowKey == $primary && $primary !== NULL}
But the edit form won't be created since NULL loosely equals to FALSE (that extends the non-working values to a string "0").
Datagrid.php
public function createComponentForm()
{
...
if ($this->editFormFactory && ($this->editRowKey || !empty($_POST['edit']))) {
$data = $this->editRowKey && empty($_POST) ? $this->getData($this->editRowKey) : NULL;
I think that $editRowKey should be strictly compared to NULL in all three conditions.
See comment 6818959
Kdyz se snazim predefinovat row block, pomoci redefine makra, tak mi aplikace spadne na teto vyjimce
Dynamic snippets are allowed only inside static snippet/snippetArea in [email protected]:6
Pokud uplne stejnymi daty zaplnim originalni sablonu, tak mi funguje uplne v poradku, v definici row nemam nic sloziteho, jenom si tam menim promennou pro zbarveni radku..
{define row}
{if $template->row->denied_user_id>0}
{var $class="background-red"}
{elseif $row->desc=="" && $row->specific=="" && $row->pn=="" && $row->price=="0,00" && $row->qty==0 && $template->row->denied_user_id==0 && $user->isAllowed("warehouse")}
{var $class="background-yellow"}
{elseif $template->row->denied_user_id==0 && $template->row->man_approval_user_id==0 && $user->isAllowed("warehouse_approval_manager")}
{var $class="background-yellow"}
{elseif $template->row->denied_user_id==0 && $template->row->man_approval_user_id>0 && $template->row->dir_approval_user_id==0 && $user->isAllowed("warehouse_approval_director")}
{var $class="background-yellow"}
{else}
{var $class=""}
{/if}
<tr n:snippet="rows-$primary" class="{$class}">
{include #row-inner}
</tr>
{/define}
Datagrid renders pagination in tfoot th tags because of this line https://github.com/nextras/datagrid/blob/master/Nextras/Datagrid/Datagrid.latte#L129
I think there should be td instead of th, even W3C think so :-) http://www.w3schools.com/tags/tag_tfoot.asp
I'm using bootstrap 2 and this causes bold font style to be used in pagination (yeah, I know I could restyle that, but...).
Zvazit moznost podpory pro hromadne akce
Zvazit pridani prime podpory pro strankovani Paginatorem, ci live loader.
Vytvorit demo.
Hello
I have an problem with filtering and pagination. The filter is not remembered and therefore not used for datasource filtration.
Any idea how to solve this issue?
Takhle vypadá kód init stavu datagridu
<div class="grid" data-grid-name="dataGrid-dataGrid">
<div id="snippet-dataGrid-dataGrid-rows">
<form action="/" method="post" id="frm-dataGrid-dataGrid-form" class="ajax" novalidate="">
<table>
<thead>
<tr class="grid-columns">
<th class="grid-col-id">
Id
</th>
</tr>
</thead>
<tbody>
<tr id="snippet-dataGrid-dataGrid-rows-1000094232">
<td class="grid-col-id">
1000094232
</td>
</tr>
<tr id="snippet-dataGrid-dataGrid-rows-1000094233">
<td class="grid-col-id">
1000094233
</td>
</tr>
<tr id="snippet-dataGrid-dataGrid-rows-1000094234">
<td class="grid-col-id">
1000094234
</td>
</tr>
<tr id="snippet-dataGrid-dataGrid-rows-1000094235">
<td class="grid-col-id">
1000094235
</td>
</tr>
<tr id="snippet-dataGrid-dataGrid-rows-1000094236">
<td class="grid-col-id">
1000094236
</td>
</tr>
<tr id="snippet-dataGrid-dataGrid-rows-1000094238">
<td class="grid-col-id">
1000094238
</td>
</tr>
<tr id="snippet-dataGrid-dataGrid-rows-1000094244">
<td class="grid-col-id">
1000094244
</td>
</tr>
<tr id="snippet-dataGrid-dataGrid-rows-1000094280">
<td class="grid-col-id">
1000094280
</td>
</tr>
<tr id="snippet-dataGrid-dataGrid-rows-1000094303">
<td class="grid-col-id">
1000094303
</td>
</tr>
<tr id="snippet-dataGrid-dataGrid-rows-1000094336">
<td class="grid-col-id">
1000094336
</td>
</tr>
<tr id="snippet-dataGrid-dataGrid-rows-1000094337">
<td class="grid-col-id">
1000094337
</td>
</tr>
<tr id="snippet-dataGrid-dataGrid-rows-1000094402">
<td class="grid-col-id">
1000094402
</td>
</tr>
<tr id="snippet-dataGrid-dataGrid-rows-1000094422">
<td class="grid-col-id">
1000094422
</td>
</tr>
<tr id="snippet-dataGrid-dataGrid-rows-1000094448">
<td class="grid-col-id">
1000094448
</td>
</tr>
<tr id="snippet-dataGrid-dataGrid-rows-1000094468">
<td class="grid-col-id">
1000094468
</td>
</tr>
<tr id="snippet-dataGrid-dataGrid-rows-1000094495">
<td class="grid-col-id">
1000094495
</td>
</tr>
<tr id="snippet-dataGrid-dataGrid-rows-1000094561">
<td class="grid-col-id">
1000094561
</td>
</tr>
<tr id="snippet-dataGrid-dataGrid-rows-1000094579">
<td class="grid-col-id">
1000094579
</td>
</tr>
<tr id="snippet-dataGrid-dataGrid-rows-1000094616">
<td class="grid-col-id">
1000094616
</td>
</tr>
<tr id="snippet-dataGrid-dataGrid-rows-1000094645">
<td class="grid-col-id">
1000094645
</td>
</tr>
</tbody>
<tfoot>
<tr>
<th colspan="1">
<div class="grid-paginator">
<span>« First</span>
<span>« Previous</span>
<span>
<span>1</span> / <span>1479</span>
</span>
<a href="/admin/order?dataGrid-dataGrid-page=2&do=dataGrid-dataGrid-paginate" class="ajax">Next »</a>
<a href="/admin/order?dataGrid-dataGrid-page=1479&do=dataGrid-dataGrid-paginate" class="ajax">Last »</a>
</div>
</th>
</tr>
</tfoot>
</table>
<input type="hidden" name="_do" value="dataGrid-dataGrid-form-submit"><!--[if IE]><input type=IEbug disabled style="display:none"><![endif]-->
</form>
</div></div>
Když kliknu v pagination na další stránku, zavolá se handlePaginate
.
V payloadu se ale vrátí:
{"state":{"dataGrid-dataGrid-filter":null,"dataGrid-dataGrid-orderType":null,"dataGrid-dataGrid-page":2},"snippets":{"snippet-dataGrid-dataGrid-rows-1000094680":"\t\t\t\t\t\t<td class=\"grid-col-id\">\n\t\t\t\t\t\t1000094680\n\t\t\t\t</td>\n\n","snippet-dataGrid-dataGrid-rows-1000094738":"\t\t\t\t\t\t<td class=\"grid-col-id\">\n\t\t\t\t\t\t1000094738\n\t\t\t\t</td>\n\n","snippet-dataGrid-dataGrid-rows-1000094758":"\t\t\t\t\t\t<td class=\"grid-col-id\">\n\t\t\t\t\t\t1000094758\n\t\t\t\t</td>\n\n","snippet-dataGrid-dataGrid-rows-1000094786":"\t\t\t\t\t\t<td class=\"grid-col-id\">\n\t\t\t\t\t\t1000094786\n\t\t\t\t</td>\n\n","snippet-dataGrid-dataGrid-rows-1000094822":"\t\t\t\t\t\t<td class=\"grid-col-id\">\n\t\t\t\t\t\t1000094822\n\t\t\t\t</td>\n\n","snippet-dataGrid-dataGrid-rows-1000094871":"\t\t\t\t\t\t<td class=\"grid-col-id\">\n\t\t\t\t\t\t1000094871\n\t\t\t\t</td>\n\n","snippet-dataGrid-dataGrid-rows-1000094937":"\t\t\t\t\t\t<td class=\"grid-col-id\">\n\t\t\t\t\t\t1000094937\n\t\t\t\t</td>\n\n","snippet-dataGrid-dataGrid-rows-1000094956":"\t\t\t\t\t\t<td class=\"grid-col-id\">\n\t\t\t\t\t\t1000094956\n\t\t\t\t</td>\n\n","snippet-dataGrid-dataGrid-rows-1000094984":"\t\t\t\t\t\t<td class=\"grid-col-id\">\n\t\t\t\t\t\t1000094984\n\t\t\t\t</td>\n\n","snippet-dataGrid-dataGrid-rows-1000095002":"\t\t\t\t\t\t<td class=\"grid-col-id\">\n\t\t\t\t\t\t1000095002\n\t\t\t\t</td>\n\n","snippet-dataGrid-dataGrid-rows-1000095042":"\t\t\t\t\t\t<td class=\"grid-col-id\">\n\t\t\t\t\t\t1000095042\n\t\t\t\t</td>\n\n","snippet-dataGrid-dataGrid-rows-1000095093":"\t\t\t\t\t\t<td class=\"grid-col-id\">\n\t\t\t\t\t\t1000095093\n\t\t\t\t</td>\n\n","snippet-dataGrid-dataGrid-rows-1000095116":"\t\t\t\t\t\t<td class=\"grid-col-id\">\n\t\t\t\t\t\t1000095116\n\t\t\t\t</td>\n\n","snippet-dataGrid-dataGrid-rows-1000095144":"\t\t\t\t\t\t<td class=\"grid-col-id\">\n\t\t\t\t\t\t1000095144\n\t\t\t\t</td>\n\n","snippet-dataGrid-dataGrid-rows-1000095177":"\t\t\t\t\t\t<td class=\"grid-col-id\">\n\t\t\t\t\t\t1000095177\n\t\t\t\t</td>\n\n","snippet-dataGrid-dataGrid-rows-1000095221":"\t\t\t\t\t\t<td class=\"grid-col-id\">\n\t\t\t\t\t\t1000095221\n\t\t\t\t</td>\n\n","snippet-dataGrid-dataGrid-rows-1000095301":"\t\t\t\t\t\t<td class=\"grid-col-id\">\n\t\t\t\t\t\t1000095301\n\t\t\t\t</td>\n\n","snippet-dataGrid-dataGrid-rows-1000095334":"\t\t\t\t\t\t<td class=\"grid-col-id\">\n\t\t\t\t\t\t1000095334\n\t\t\t\t</td>\n\n","snippet-dataGrid-dataGrid-rows-1000095335":"\t\t\t\t\t\t<td class=\"grid-col-id\">\n\t\t\t\t\t\t1000095335\n\t\t\t\t</td>\n\n","snippet-dataGrid-dataGrid-rows-1000095376":"\t\t\t\t\t\t<td class=\"grid-col-id\">\n\t\t\t\t\t\t1000095376\n\t\t\t\t</td>\n\n"}}
Problém je v tom, že se nevrací invalidovaný snippet rows
, ale jen invalidované snippety řádků na další stránce. Přemýšlím, jestli něco dělám špatně nebo jsem našel bug?
Nette 2.4, Datagrid dev-master
handlePaginate
v kódu invaliduje rows
Díky
Někdo kdo přijde k Nette poprvé, nebo nikdy nepracoval s něčím podobným bude mít docela problém sám vyzkoumat, jak tu komponentu vlastně dostat do šablony a vykreslit.. (A to samé teda by chtělo i pro BS3 renderer v nextras/forms)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.