sergeymatveev88 / drf-dx-datagrid Goto Github PK
View Code? Open in Web Editor NEWServerside realisation of grouping, filtering and sorting for DevExtreme datagrid on django rest framework
License: MIT License
Serverside realisation of grouping, filtering and sorting for DevExtreme datagrid on django rest framework
License: MIT License
First of all, thank you very much for your contribution.
I have a problem with the summary and the totalItems. These are the steps that I perform in a data grid.
I have this codepen: (https://codepen.io/Diego_MF/pen/MWEpbbG) where I communicate with one devexpress api and all this that I tell you works well.
When I look at how the data comes in, I see differences in it.
This is how it comes on devexpress:
{"data": [{"key": "Arizona", "items": null, "count": 1, "summary": [1]}], "summary": [1]}
{"data": [{"OrderNumber": 39420, "SaleAmount": 20500, "StoreCity": "Tuscon", "StoreState": "Arizona", "Employee": "Jim Packard", "OrderDate": "2013 / 12/28 "}]," summary ": [1]}
This is how it comes from the DRF api:
{"data": [{"key": "City", "count": 1, "summary": [1], "items": null}]}
{"totalCount": 1, "summary": [1], "data": [{"city_key": "10001", "city_code": "bue", "city_name": "Buenos Aires"}]}
Also, within my script I have declared remoteOperations: true
and the summary is declared like this:
summary: { totalItems: [{ column: "city_key", summaryType: 'count' }] }
I use Django version 3.2.4 and djangorestframework version 3.12.4
Great project! It helped me a lot. Thanks for your efforts. However, I couldn't achieve case-insensitive filtering.
Although I set filtering to case-insensitive in settings.py, grid filtering is still case-sensitive.
REST_FRAMEWORK = { 'DRF_DX_DATAGRID': { 'FILTER_CASE_SENSITIVE': False} }
Reproduce steps:
Expected: Correct filter data was returned
Actual: Server 500 status code
Exception:
File ".../venv/lib/python3.8/site-packages/drf_dx_datagrid/viewsets.py", line 38, in list queryset = self.filter_queryset(self.get_queryset()) File ".../venv/lib/python3.8/site-packages/rest_framework/generics.py", line 150, in filter_queryset queryset = backend().filter_queryset(self.request, queryset, self) File ".../venv/lib/python3.8/site-packages/drf_dx_datagrid/filters.py", line 93, in filter_queryset q_expr = self.__generate_q_expr(filter) File ".../venv/lib/python3.8/site-packages/drf_dx_datagrid/filters.py", line 79, in __generate_q_expr raise Exception("Невозможно применить данный поиск")
When using exclude approach on the headerfilter the operator you will get is "!",
in my case it was:
['!', ['status', '=', 'P']]
on dx_filter variable
REST_FRAMEWORK = {
'DRF_DX_DATAGRID': {
'FILTER_CASE_SENSITIVE': False}
}
should be...
REST_FRAMEWORK = {
'DRF_DX_DATA_GRID': {
'FILTER_CASE_SENSITIVE': False}
}
Hi,
How to DISABLE case sensitive search and filter on drf-dx-datagrid devextreme datagrid?
Regards.
Hi Unable to display the m2m field in the grid filter it is showing the django id instead
current_responsible = serializers.SlugRelatedField(many=True,read_only=True,slug_field='username')
current_responsible = models.ManyToManyField(User,verbose_name= "Current Responsible")
{ dataField: "current_responsible",selector:"current_responsible__username", caption: "Responsible", dataType: "string", alignment: "left",allowFiltering:false,allowHeaderFiltering:true},
Hi ! First of all, thank you very much for your very useful package. It saved me a lot of work to make my Django Rest Framework => Angular work with Devextreme (sooo powerful lib).
I just wanted to say that I lost some time to figure out why my requests were 'case sensitive only', before finding the reason in the 'filters.py' file. It would perhaps be a good idea to add a line in the doc for the FILTER_CASE_SENSITIVE settings.
BTW, thanks again for your great work ! Best regards.
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.