Skip to content

Conversation

VojtechBuba
Copy link

When Datagrid is used with common database like data sources, it is common, that receiving total count for paging cost extra one query. When working with REST API datasource it is best practice that response for getting resource collection contains information about total count.

For the purposes of creating query only offset and limit is necessary. The total count is necessary for two reasons. First is to show UI component with list of pages. Second to check if requested page number is not higher that collection maximum.

The problem with current model is, that the order in witch get total count is received cost two calls on Rest API endpoint instead of one. I suggest to move call of getCount() method after getting data. When working with DB, it does not matter if the getCount() call is sooner or later with performance in mind.

I have already created PR #1037 but i`ve change my mind and created this PR.

DataModel now implements interface and Datagrid use interface instead of specific implementation. For purposes of REST based datasources i have created new DataModel where order of getCount method call is changed.

If somebody wants to change datamodel, it can be done with new method setDataModel.

 Simple refactoring, just introducing interface for datamodel. This change is without bc break. Now it is possible do to change datamodel with new method setDataModel.
zipper and others added 6 commits September 12, 2022 11:39
… has a value eg. with `.`, the jQuery sizzle engine throws an error when there are no qutes around the value.
Fixing missing quotes in CSS attribute selectors
- defining blocks for column actions and inline add/edit buttons
- these blocks can be overwritten and custom render can be used (change order, grouping of buttons, etc.)
Defining blocks for column actions and inline add/edit buttons
- `\Nette\Forms\Controls\Checkbox::getControl` returns label part and control part like one ``\Nette\Utils\Html` and then `$control->getControl()->getAttribute('class')` is always null and custom defined classes are always overwritten by `$control->setAttribute('class', 'form-control input-sm form-control-sm');`
- fixed by using `\Nette\Forms\Controls\BaseControl::getControlPrototype` which always returns only control part without label part
Fixing custom classes on checkbox in inline edit
@f3l1x
Copy link
Member

f3l1x commented Jun 21, 2023

Tohle vypada dobre, jen je potreba to prehodit na next vetve.

@f3l1x f3l1x self-assigned this Mar 12, 2025
@f3l1x f3l1x added the W: Rebase Waiting For Rebase label Mar 12, 2025
@f3l1x
Copy link
Member

f3l1x commented Mar 12, 2025

Please, rebase it if it is still relevant.

@f3l1x f3l1x force-pushed the master branch 4 times, most recently from 2cf6ef8 to 828c81d Compare May 31, 2025 14:11
@f3l1x
Copy link
Member

f3l1x commented Jul 3, 2025

@radimvaculik I like RestModelDatasource etc. But this PR includes more features, WDYT?

@radimvaculik
Copy link
Member

Agree. I will close it and create separete PRs.

@f3l1x
Copy link
Member

f3l1x commented Oct 17, 2025

ping @radimvaculik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

W: Rebase Waiting For Rebase

Development

Successfully merging this pull request may close these issues.

6 participants