alwint3r / sequelize-datatable-node

MIT License
11 stars 12 forks source link

Use where clause #6

Closed ThomasD013 closed 6 years ago

alwint3r commented 6 years ago

I'm afraid this library is not compatible yet with the latest sequelize version. Right now it only supports sequelize v3.x.x, and I don't have the time to work with sequelize v4 or later. If you're interested on helping me working on this, then your help would be much appreciated

alwint3r commented 6 years ago

Sorry for not asking first, can you show me the code to reproduce your issue?

On Wed, Mar 21, 2018 at 2:35 AM Arkantick notifications@github.com wrote:

I'm using sequelize v3 :/

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/alwint3r/sequelize-datatable-node/issues/6#issuecomment-374728814, or mute the thread https://github.com/notifications/unsubscribe-auth/AMVjnc3H70XEYlEH67OTrvdH_opn3zPTks5tgVnlgaJpZM4SyLuJ .

-- Alwin Arrasyid

alwint3r commented 6 years ago

If I remember correctly, you can add your where clause as a property to an object for the third arguments of datatable function call.

For example

router.post('/:id', (req, res) => {
    datatable(model.Transactions, req.body, { where: { type: 1 } })
        .then((result) => {
        // result is response for datatables
        res.json(result);
    });
});
alwint3r commented 6 years ago

No problem.