Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introducing interface for DataModel #1038

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

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.

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

Successfully merging this pull request may close these issues.

None yet

4 participants