Giter Site home page Giter Site logo

sergeymatveev88 / drf-dx-datagrid Goto Github PK

View Code? Open in Web Editor NEW
17.0 17.0 11.0 38 KB

Serverside realisation of grouping, filtering and sorting for DevExtreme datagrid on django rest framework

License: MIT License

Python 100.00%
data-grid devextreme django django-rest-framework drf dx-data-grid modelviewset restframework

drf-dx-datagrid's People

Contributors

ant2012 avatar sergeymatveev88 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

drf-dx-datagrid's Issues

Problems with summary and total Items

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.

  1. I start the grid with a summaryType, of type count, on a column. Ex: total: 55
  2. Group on another column. The total remains at 55
  3. Filter on a value of the grouped column. The total should be changed to 1, but remains at 55.

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

Filtering Case Sensitive

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

HeaderFilter - Exclude not working

Reproduce steps:

  1. Open some headerfilter
  2. Select all using 'Select All' button (dont submit filter yet)
  3. Deselect one item from headerfilter
  4. Press 'OK' to submit the filter

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

error in README.md

REST_FRAMEWORK = {
'DRF_DX_DATAGRID': {
'FILTER_CASE_SENSITIVE': False}
}

should be...

REST_FRAMEWORK = {
'DRF_DX_DATA_GRID': {
'FILTER_CASE_SENSITIVE': False}
}

Django Many to Many Fields

Hi Unable to display the m2m field in the grid filter it is showing the django id instead

in seralizer im using like below code

current_responsible = serializers.SlugRelatedField(many=True,read_only=True,slug_field='username')

in db models.py

current_responsible = models.ManyToManyField(User,verbose_name= "Current Responsible")

in html

{ dataField: "current_responsible",selector:"current_responsible__username", caption: "Responsible", dataType: "string", alignment: "left",allowFiltering:false,allowHeaderFiltering:true},

Note: filtering is not working for m2m fields

Default FILTER_CASE_SENSITIVE setting setted to 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.

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.