GithubHelp home page GithubHelp logo

uestla / twigrid Goto Github PK

View Code? Open in Web Editor NEW
17.0 5.0 10.0 510 KB

TwiGrid - datagrid built on top of Nette Framework

Home Page: http://forum.nette.org/cs/13181-twigrid-omlouvam-se

CSS 2.32% JavaScript 17.27% PHP 59.90% Latte 20.51%
php nette datagrid sorting filtering row-actions group-actions pagination inline-editing twitter-bootstrap

twigrid's Issues

Strange behavior of multiple sort

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:

  • column name => oh no, this is single sort and my previous multi-sort was killed.
  • displayed sorting arrow => this does not function (however this icon does make sense to use for change the order of sort; for example with 180° rotated icon on hover)
  • "+" button => OK, the order of sort is changed.

And what about to change back the name column from DESC to ASC order preserving firstly sorting?

  • OK, i know: "+" changed me in the previous step => click => oh no, my first sort is now on surname only and previous name column sort by first was killed (if I had only 2 multisorts). Actually the "+" button has no function of add multiple sort, but has the function of drop current column from multiple sort realistically.

Proposed solution:

  • "+" button is used only to add the column to multisort
  • for changing between ASC and DESC order is used "^" or "v" icon hovered to opposite site
  • after the column is added to multisort "+" icon is replaced by "x" button to cancel sort on this column

EDIT:
For consideration:

  • after multisorting is activated, click on column label has the meaning of change the order instead of cancel multisort order to column-only order

build() is called too early in component lifecycle

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.

Summary row at the end of the Grid

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?

"multisort" class in all headers

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).

end() expects parameter 1 to be array, null given

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}
        &nbsp;
    {/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}

Compatibility with PHP 7.0.19

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.

Possibility to wrap header to multiple lines.

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

Unable to render DataGrid inside snippet using AJAX

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?

Possibility to decorate rows/cells

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.

@deprecated method accessing

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'));

Localization of "No data." message

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?

composer dependency forcing to download 2.4RC1

"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

More than one grid at presenter

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
			}
		}
	}

Chybějící buňka v patičce

Ahoj, když si přidám inline edit, tak se rozhodí rozložení tabulky, resp. v patičce chybí buňka posledního sloupce.

twigrid

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.