o5 / grido Goto Github PK
View Code? Open in Web Editor NEWGrido - DataGrid for Nette Framework
Home Page: http://o5.github.io/grido-examples/
License: MIT License
Grido - DataGrid for Nette Framework
Home Page: http://o5.github.io/grido-examples/
License: MIT License
Pokud si pověsím nějaký callback na "operations" např. "Delete" pro smazání položek, mám problém v tom, že po vyřízení callbacku se Grid snaží jaksi znovuvygenerovat a vyhodí chybu Nette\InvalidStateException:Component with name 'xx' already exists.
V sandboxu se neprojevuje, protože tam je na konci funkce callbacku volán "redirect" - potom k problému nedojde. Ale co kdybych chtěl po vyřízení callbacku grid jen ajaxově invalidovat?
Dík
Grido already has css class center for centering displayed cells and I suggest to add classes right (especially useful for numbers) and left can be added as well:
.grido .right {text-align: right}
.grido .left {text-align: left}
..which is missing
V column.php ve funkci setDefaultSorting je špatné volání.
Je
$this->grid->setDefaultSorting(array($this->getName() => strtolower($sorting)));
Má být
$this->grid->setDefaultSort(array($this->getName() => strtolower($sorting)));
In Grid.php, on line 949
$form->addSelect('count', 'Count', array_combine($this->perPageList, $this->perPageList))
->controlPrototype->attrs['title'] = $this->getTranslator()->translate('Items per page');
function does not work correctly. Remains the original text.
In the Czech translation should be "Položek na stránku", but it remains an English version.
Please add support for the Nette 2.1 (aka dev version). I'm not sure if there are any relevant BC breaks, if not, then it's only a matter of changing composer.json definition.
Včera jsem zjistil, že v demu přestalo fungovat napovídání sloupce "country".
Napovídá to např.: cz
místo Czech Republic
.
Došlo k rozdělení presenterů a zárověň záměny názvu sloupce country
=> country_code
, ovšem pouhá změna nazpět problém neřeší, stejně tak nastavení sloupce c.title
u filtru.
Začala mě z toho bolet hlava, tak jsem toho raději nechal.. :))
Při zjišťování počtu záznamů, si zbytečně grida nechává vracet všechny záznamy, díky špatnému volání getCount() ve tříde NetteDatabase.php.
Správně by mělo být:
/**
* @return int
*/
public function getCount()
{
return $this->selection->count('*');
}
Bylo by fajn umožnit v definici grido výčet možných exportů, resp. export třeba vůbec neumožnit. Mám tím na mysli trochu převorat celý mechanismus exportů:
v metodě
public function setExporting($name = NULL, $type = 'Grido\Export')
by se jako druhý parametr uvádělo pole možných exportů array('csv','xls','pdf' ...) uvedené pořadí by se samořejmě ctilo. Tato metoda by sama nevytvářela novou instanci exportovací třídy, ale ta by se vytvářela až při samotném zpracování požadavku na exportování. V případě, že by se metoda vůbec nevolala, export gridy by se uzivateli neumožnil.
Nutný přepokladem je, že každý exportní formát ($type) by měl být oddělený ve vlastní tříde (teď to tak není).
Je to jen návrh možného řešení, třeba vás napadne něco chytřejšího :-)
Současný stav je nevyhovující a důvodem je, že Grido bylo stavěno pro Dibi. Takže z gridu lezou condition typu array('([column] = %f)', 3.14);
a tedy ostatní drivery (datasource) musí obsahovat metody jako např.: removePlaceholders()
apod.
Zatím jsem se tomu do hloubky moc nevěnoval, první krok jsem ale udělal: založil tuto issue :))
Pokud by někdo věděl => pls pull, než se k tomu já dostanu. Budou to zřejmě konce řádků pro WIN.
Pokud se nedefinují/nepouživají filtry, zmizí možnost exportu. Možná bych pro tlačítko exportu volil jinou pozici. Co třeba někam na lištu stránkovače?
Bylo by pekné, kdyby setDisable()
akci neskrylo, ale jen přidalo class="disabled"
(viz: http://twitter.github.com/bootstrap/base-css.html#buttons sekce Disabled state).
Návrh řešení:
setDisable
na setHidden
a setDisable
označit @deprecated.setDisabled
(s d na konci) s požadovanou funkčností.It is really necessary that Primary key attr has to be public in entity? Why dont you use getter in property accessor?
It would be great to add a columns SUM feature. It can be attached to the grid in the same way as filters are.
Just the last row of the grid would contain sums of the (numerical) columns, specified by user by ->addSum()
From my point of view the funcionality should be sum of the visible rows (when paginator is enabled) or all rows without paginator.
Podpora ArrayAccessu není u entit samozřejmá, může nastat chyba třeba zde https://github.com/o5/grido/blob/master/Grido/Grid.php#L853. Bylo by dobré mít možnost nastavit vlastní třídu, která bude k parametrům entit přístupovat (viz https://github.com/Venne/framework/blob/master/Venne/Tools/Objects.php).
Nevím proč, ale současná implementace metody setSortable()
, resp. její parametr mi přijde zbytečný. Napadlo mě, že pokud by se uvedl parametr, tak by se zároveň nastavilo i defaultní řazení přes alias setDefaultSort()
.
Hello guys,
I know Grido supports both JS and non-JS modes, but when JS is enabled it would be nice if inline editing could be enabled as well.
My idea is this: When cell is clicked, the cell content of TD tag is saved into some JS variable, then the content is replaced by ajax call for editable element (for example Input text for text field) and onBlur (or onSubmit via Enter) the new value is sent to database and if successful, the original TD content is restored and value is changed via JS/Jquery as well (.value="new value"). If unsuccessful, original TD content is restored but value is not changed (and error can be displayed).
Alternatively the new value may be read from database once saving ajax request is finished but that means additional ajax call. However it may be good for verification.
In case you do not plan to implement this feature, can you point me in the correct direction - how to get particular cell identification so I can hook up events?
Thank you very much,
Jan
TODO:
FEATURES:
TASKS:
1. Verzi (současný tests) s E_USER_DEPRECATED hodit jako 0.9.2?
2. Nějaké další návrhy na přejmenování metod / tříd / BC BREAKY?
3. Připomínky?
V návaznosti na tento thread jsem přemýšlel, jak daný problém řešit.
Nechtělo se mi jít otrockou cestou typu:
$grid->dataSourceCallbackMethodGetCount = function() {
//...
};
Takže mě napadlo následující:
$grid->model->proxy['getCount'] = function(\Grido\DataSources\DibiFluent $dataSource) {
return $dataSource->fluent->count();
};
//je samozřejmě možné "přetěžovat" všechny metody implementující IDataSource,
//přičemž argumenty volané z gridu jsou předány jako pole v druhém parametru
$grid->model->proxy['limit'] = function($datasource, $args) {
$offset = $args[0];
$limit = $args[1];
//...
};
To řešení se mi zamlouvá, tak doufám, že se můj postoj časem nezmění :))
Nejspíše se do sessions ukládá jméno komponenty, které je v obou případech stejné. Řešením je mít každou komponentu pojmenovanou jinak.
http://forum.nette.org/cs/13109-grido-datagrid-pro-nette?p=3#p101439
Would be nice to separate front end thingy from PHP to use bower and composer.
Thanks
Hi,
grido look like really good tool, but I have one note. In filter of your demo, you have some text inputs and two selects (card and gender). When I write to the text input or pick from the autocomplete results are still same - there is not event for sending filter form, but when I pick from select box filter form is send.
So you have two different behavior of filter fields, so I would recommended to unite :) And for advanced you can do setting for it :) something like "setLiveFilter" - I don't know better name :)
Very good work! Thanks.
Příklad chyby:
$grid->setDefaultSort(array('id' => 'DESC'));
Po načtení se seřadí správně sestupně dle id, po kliknutí na sloupec id se řazení nezmění na ASC, ale zůstane DESC. Pokud kliknu na jiný sloupec a pak zpět na sloupec id, řazení se provede ASC, po kliku znovu na id se provede řazení DESC, po dalším kliku na id již nadále zůstává DESC. Testováno s Dibi i ORM.
Funkční podoba:
$grid->setDefaultSort(array('id' => 'ASC'));
DataSource, které implementuje toto rozhraní, bude podporovat našeptávání.
Jedná se o čistší řešení namísto method_exists($this->model, 'suggest')
.
Zdravim,
uprava funkce removePlaceholders(array $condition) v Grido/DataSources/NetteDatabase funguje pouze pro MySQL. Pro Postgre nefunguje - neakceptuje znak pro uvozeni jmena tabulky. Myslim, ze znak
je MySQL specialita. Nejlepsi by podle me bylo zavorky uplne odstranit.
Nebo je pripadne nahrazovat podle driveru ktery Nette/Database pouziva: ` - MySQL, " - Postgre ..atd. Ale to mi prijde zbytecne. Kazda databaze by mela vzit jmeno tabulky bez uvozeni. To se pouziva jen u specialnich nazvu( treba v postgre, kdyz nazev tabulky zacina cislem.. to jsou ale vyjimky).
Paradni grid!
Název sloupce se obalí do hranatých závorek a způsobí to chybný dotaz.
http://forum.nette.org/cs/13109-grido-datagrid-pro-nette#p94188
Jde nějakým způsobem zakázat překladač na určitý filtr? Mám například ve filtru hodnoty jazyků, ale nechci je překládat.
Když jsem přidával do sandboxu ukázku Doctrine, zjistil jsem, že driver si nerozumí s custom condition.
Chybu lze nasimulovat přidáním následujícího např. sem.
$grid->addFilterCheck('preferred', 'Only preferred girls :)')
->setCondition(Filter::CONDITION_CUSTOM, array(
TRUE => 'gender = "female" AND centimeters >= 170' //for checked
));
url: http://localhost/grido-sandbox/www/outer/doctrine/default/ajax-off/?grid-filter%5Bpreferred%5D=✓
laděnka: http://goo.gl/42mDT
Podobný problém byl i u Nette\Database.
Hi guys,
In my desperate attempt to simulate multiselect I came to an idea to do it by using multiple checkboxes with negated conditions and default value true (=checked).
I tried to do it like this:
$grid->addFilterCheck("state1", "Paid")
->setCondition(Filter::CONDITION_CUSTOM, array(
FALSE => '[state] <> "PAID"'
))->changeValue(TRUE);
$grid->addFilterCheck("state2", "Unpaid")
->setCondition(Filter::CONDITION_CUSTOM, array(
FALSE => '[state] <> "UNPAID"'
))->changeValue(TRUE);
$grid->addFilterCheck("state3", "Cancelled")
->setCondition(Filter::CONDITION_CUSTOM, array(
FALSE => '[state] <> "CANCELLED"'
))->changeValue(TRUE);
Here are the issues:
With custom cell renderer it would be possible to assign cell's class/style based on its value.
For example with "checkbox columns" (having values 0/1) which could be colored according to their state. (Coloring the whole row is already possible, but that's not what I need.)
I just noticed Grido does not support multiselect.
Please add new add addFilterMultiSelect filter to allow to select multiple items by using Nette's MultiSelectBox component. Grido should display rows matching all selected items, so yes - IN SQL operator will make it.
Alternatively you can extend addFilterSelect by adding third parameter indicating multiSelect.
BTW - if you need boostrap css/js multiselect code, I found this:
http://davidstutz.github.io/bootstrap-multiselect/
however any simple multiselect will be fine.
Thank you very much!!!
If you have zero value (or another falsy value, say an empty string) primary key, action links are wrong.
This is caused by code in Grido\Components\Actions::getElement:
} elseif ($primaryValue) {
$this->arguments[$primaryKey] = $primaryValue;
$href = $this->presenter->link($this->getDestination(), $this->arguments);
}
First, when primary key is zero, empty string or another falsy value, this code branch is not entered. This can be probably fixed by elseif ($primaryValue === NULL)
.
Second, what types of primary key are supported? Is it OK to assume there is no NULL? (Probably OK in 99.999 % cases.)
Third, if none of these conditions is matched, it silently returns a wrong link. Should an exception be thrown?
Pokud nedefinuji žádné filtry dojde k pádu na řádku 439 v Grid.php:
431: /**
432: * @internal
433: */
434: public function getFilterRenderType()
435: {
436: if ($this->filterRenderType === NULL) {
437: $this->filterRenderType = Filter::RENDER_INNER; //default
438:
439: $filters = $this[Filter::ID]->getComponents();
440: foreach ($filters as $filter) {
441: if (!$this[Column::ID]->getComponent($filter->name, FALSE)) {
442: $this->filterRenderType = Filter::RENDER_OUTER;
443: break;```
Líbilo by se mi :), kdyby šlo krom INNER / OUTER renderování filtrů, zvolit i něco jako BOTH, kdy by se filtry, které k sobě mají sloupec renderovali jako INNER a ty co k sobě sloupce nemají by byli jako OUTER.
Při exportu se špatně generuje název souboru i s apostrofy
v libs\Grido\Components\Export\Export.php
94 $response->setHeader('Content-Disposition', "attachment; filename='{$this->name}.{$this->type}';");
správně má být
94 $response->setHeader('Content-Disposition', "attachment; filename={$this->name}.{$this->type};");
Less important FilterCheck issue at the moment - with multiple checkboxes and ajax enabled and with slower connection/server, after the clicking on first checkbox, user can click on other checkboxes before first ajax request is finished.
This causes user's second request beeing reverted back (i.e. checked checkbox is suddenly unchecked). Such a behavriour with multiple checkboxes looks chaotic and can confuse the user.
(One solution would be to disable checkboxes whilst any ajax request is running, other to do ajax only after button click, or another to not to re-draw filter section after check box is changed - only the datagrid ... Each of them has some drawbacks...)
Jedná se pouze o tento řádek:
{_'Items %d - %d of %d', $paginator->getCountBegin(), $paginator->getCountEnd(), $control->count}
Pokud nastavím do roletky hodnoty 50, 100, 200, 500, 1000 tak se zpracovává pouze 50 a 100 zbytek prostě nefunguje a zpracovává se to jako by to bylo 50
Hi,
if I add simple custom renderer to action, rendered element has no href
attribute. See code below:
$grid->addActionHref('action', "Don't do it!")
->setIcon('ban-circle')
->setCustomRender(function($item, \Nette\Utils\Html $el) {
return $el;
})
Grido generates strange filename while trying to export files in Opera. It appears in chinese characters. Any idea what could be wrong? Other browsers work fine.
V exportu se nezohlednuje Column::setReplacement(), tedy se nenahrazují hodnoty preferovanými.
Viz například zde: https://github.com/o5/grido/blob/master/Grido/Grid.php#L278
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.