uestla / twigrid Goto Github PK
View Code? Open in Web Editor NEWTwiGrid - datagrid built on top of Nette Framework
Home Page: http://forum.nette.org/cs/13181-twigrid-omlouvam-se
TwiGrid - datagrid built on top of Nette Framework
Home Page: http://forum.nette.org/cs/13181-twigrid-omlouvam-se
The latest Latte fail with this library on
The assignment in the {include #body-row,
$recordVariable => $record,
primaryString => ($primaryString = ...} looks like an error
Because of this
TwiGrid/src/TwiGrid/DataGrid.latte
Line 355 in 97f4193
Latte changelog:
https://github.com/nette/latte/releases/tag/v2.9.2
There is a strange behavior of multisorting:
I click a "+" button on name for example (this column is sorted first), then click "+" button" on surname for example (this column is sorted second). There are "+" buttons on these columns still.
Now I would like to change sort the name column (firstly sorted column) from ASC to DESC order. So let's try it by click to:
And what about to change back the name column from DESC to ASC order preserving firstly sorting?
Proposed solution:
EDIT:
For consideration:
The whole problem is described there
https://github.com/nette/application/issues/280
I'm not sure in which code is a real bug. But I would think that in both.
Use this inside of NControl
is weird, wjen it causing attempt to create a component named "columns"
if (!isset($this['columns'])) {
$this['columns'] = new NContainer;
}
I need to react on a signal by handleDisplay($year, $month)
method, but it is not possible, because build()
method is evaluated before a signal is processed. It is the correct behavior? I would expect that would be possible to change the grid configuration based on signals.
I often need some summary row at the end of the grid with total or average values.
I'm doing it usually by adding one more row with the special class to style it differently.
But I don't found a way how to handle it if I have some special formatting rule for one column, which should not apply to the last row.
Like
{define body-cell-month-content}
<a href="{plink :month $record->year, $record->month}">{$$recordVariable |getValue:$columnName:FALSE}</a>
{/define}
The last row should not be clickable. Is there some official way how to do it?
In latest version 11.2.1 is one strange thing.
All column headers has class 'multisort' also when column doesn't have allowed sorting by setSortable()
, so all columns has additional space on the right, but without sorting icon, which looks weird, if you are not using sorting. I found that it is possible turn it of by setMultiSort(false)
.
Pokud chci využívat filtry, a nesplním jejich podmínky, vypíše se alert (správně), ale pokud projde vstup input buttonu přes form rules a je hodnota validní, vypíše to chybu end() expects parameter 1 to be array, null given na řádku označeném níže. Využívám TwiGrid již dlouho, několik chyb jsem po po 2.4RC odstranil a zašlu pak patch, každopádně přes tuto chybu se dostat ani já nedokáži.
{define filter-cell}
<th n:class='filter-cell, ($hasControl = isset($form["filters-criteria-$column"])) && !($isControl = ($form["filters-criteria-$column"] instanceof Nette\Forms\IControl)) ? alert-warning'>
{if $hasControl && $isControl}
{php }{input filters-criteria-$column, class => 'form-control'} <--- Zde
{else}
{/if}
</th>
{/define}
Každopádně, pokud se s aktuální verzí vyzkouší filtrování, deprecated problémů je opět více. Např. co vyhodí User Notice:
value => $template->getValue($record, $name, FALSE)
či toto (Accessing parameters via. $template->param is deprecated, nyní v Nette/Latte neexistuje způsob jak v Latte nastavit parametr, jedině skrze renderBlock).
{var $template->hasData = (bool) $iterations}
Latest version currently available for Raspberry Pi is 7.0.19.
I tried latest version and it crash just because of "?" used here public function getColumns(): ?\ArrayIterator
or public function getItemsPerPage(): ?int
. This is some new syntax of 7.1? I did not found any information about it yet. But without it, it normally works on booth versions.
Would be great if will be possible do this
$this->addColumn('area', "Plocha bytu\n[m²]");
Currently it is possible by customize template, but maybe something like this should be supported in the default one, just by adding |breaklines
We have DataGrid control inside snippet. If we make AJAX request which invalidates this snippet DataGrid ens in fatal error. Reason is passForm() mechanism. Form is not passed to template and it fails to render.
If we remove passForm conditions from render method (currently line 871) eberything works as expected.
What is purpose of this condition?
Only thing that I miss most is possibility to decorate rows and cell.
I mean mainly possibility to add custom class per row or cell in similar way how ValueGetter is done.
Ideally some interface with several methods which will be called for every row or cell and allows to ad class there or completely change content of the desired cell, like add some html element into it.
On line https://github.com/uestla/twigrid/blob/master/src/TwiGrid/DataGrid.php#L130, $this->name
will always be null
and is therefore redundant. Right now, I can't tell if it matters that the session namespace is the same for all datagrids, so take this as a heads up :)
Because of new Nette SmartObject strict is really important to change callback calls from ($this->function) to callback($this, 'function').
For ex:
$latte->addFilter('translate', callback($this, 'translate'));
Hi!
Currently the message "no data" is showing directly in body block. If we want to change this message, there is need to rewrite the whole body block (around 60 lines of code) just to use something like _'admin.grid.empty'
.
Can you split the body block into smaller pieces? Or at least define new block for the message? Something like
{define body-empty}
Or an option for defining empty message for the given grid? Something like
$grid->setEmptyMessage('admin.grid.empty');
Or do you have any other idea how to deal with this?
"require" : { "php": ">= 5.3.0", "nette/http": "^2.3", "nette/forms": "^2.3", "nette/utils": "^2.3", "nette/application": "^2.3"
To this:
"require" : { "php": ">= 5.3.0", "nette/http": "~2.3", "nette/forms": "~2.3", "nette/utils": "~2.3", "nette/application": "~2.3"
Cause it forces automatically to download 2.4RC1
fix
protected function attached($presenter){
if($presenter instanceof NPresenter){
$this->build();
parent::attached($presenter);
$this->session = $presenter->getSession(__CLASS__ . '-' . $this->getName());
if(!isset($presenter->payload->twiGrid)){
$this->payload = $presenter->payload->twiGrid = new \stdClass();
$this->payload->forms = [];
}else{
$this->payload = $presenter->payload->twiGrid; // this is fix
}
}
}
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.