Giter VIP home page Giter VIP logo

Comments (5)

eherve avatar eherve commented on September 10, 2024

Hi Steven,

Thanks for using this plugin.
I still follow questions and issues on this plugin, and try to answer as soon as possible.

Regarding your question, date are tricky to use for filtering and not well documented sorry.
The best way would be to override the date condition handler https://github.com/eherve/mongoose-datatable#condition-handlers and to build your mongodb search.

To select the condition handler I base the selection on the mongoose field type, so if it is a Date it will trigger the date condition handler.

I hope this will help you.

Regards,

from mongoose-datatable.

stang1013 avatar stang1013 commented on September 10, 2024

Thanks a lot, I'll try it out.

Regards.

from mongoose-datatable.

stang1013 avatar stang1013 commented on September 10, 2024

Your suggestion helps. great appreciated. BTW, if I want to implement the column summarize, ig, one column with all numbers, want to summarize all the column items filtered in different pages(same page column items summarize are easy ), any suggestion?

Regards
Steven

from mongoose-datatable.

eherve avatar eherve commented on September 10, 2024

Hi,

You want to sum all of one column data from all filtered results and expose it ?
Since this plugin is sending back only the page data you'll have to do it on your server.
I would do it manually with an aggregate and a reduce on mongodb (https://docs.mongodb.com/manual/reference/operator/aggregation/reduce/)

I hope this helps

from mongoose-datatable.

stang1013 avatar stang1013 commented on September 10, 2024

Thanks Eric for the suggestion, I updated the plugin library to satisfy my needs, in the rest before schema.dataTable call, user can define the column's to be summarized
req.query.search.sumcol= ['amount'];
In the fnDrawCallback of the data-table client, this.api().ajax.json() will have sumCol object which contains the summarize of all columns requested, in my case, it is only amount column: this.api().ajax.json().sumCol.amount.

If you need the one I updated, I can either send the updated code to you or check it in directly.

from mongoose-datatable.

Related Issues (20)

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.