alwint3r / sequelize-datatable-node

MIT License
11 stars 12 forks source link

Search inside table doesn't work #5

Closed bartmanskyi closed 4 years ago

bartmanskyi commented 6 years ago

Hello I can't search inside table. Can you help me? Unhandled rejection Error: Invalid value { name: { '$like': '%a%' } } at Object.escape (c:\_xampp\htdocs\node\test7\node_modules\sequelize\lib\sql-string.js:51:11) at Object.escape (c:\_xampp\htdocs\node\test7\node_modules\sequelize\lib\dialects\abstract\query-generator.js:924:22) at _joinKeyValue.value.map.item (c:\_xampp\htdocs\node\test7\node_modules\sequelize\lib\dialects\abstract\query-generator.js:2319:69) at Array.map (<anonymous>) at Object._whereParseSingleValueObject (c:\_xampp\htdocs\node\test7\node_modules\sequelize\lib\dialects\abstract\query-generator.js:2319:52) at Object.whereItemQuery (c:\_xampp\htdocs\node\test7\node_modules\sequelize\lib\dialects\abstract\query-generator.js:2077:19) at Utils.getComplexKeys.forEach.prop (c:\_xampp\htdocs\node\test7\node_modules\sequelize\lib\dialects\abstract\query-generator.js:1944:25) at Array.forEach (<anonymous>) at Object.whereItemsQuery (c:\_xampp\htdocs\node\test7\node_modules\sequelize\lib\dialects\abstract\query-generator.js:1942:35) at Object.getWhereConditions (c:\_xampp\htdocs\node\test7\node_modules\sequelize\lib\dialects\abstract\query-generator.js:2410:19) at Object.selectQuery (c:\_xampp\htdocs\node\test7\node_modules\sequelize\lib\dialects\abstract\query-generator.js:1130:28) at QueryInterface.select (c:\_xampp\htdocs\node\test7\node_modules\sequelize\lib\query-interface.js:1018:27) at Promise.try.then.then.then (c:\_xampp\htdocs\node\test7\node_modules\sequelize\lib\model.js:1564:34) at runCallback (timers.js:789:20) From previous event: at Function.findAll (c:\_xampp\htdocs\node\test7\node_modules\sequelize\lib\model.js:1561:8) at Function.findAndCount (c:\_xampp\htdocs\node\test7\node_modules\sequelize\lib\model.js:1869:28) at buildSearch.then.then.then.then.newParams (c:\_xampp\htdocs\node\test7\node_modules\sequelize-datatables\src\index.js:149:15)

My conf: "datatables.net-bs4": "^1.10.16", "mysql2": "^1.5.0", "sequelize": "^4.22.6", "sequelize-datatables": "^1.2.1",

I know that sequelize-datatables works only with Sequelize v3, but maybe it's easy to adapt for v4

search

alwint3r commented 6 years ago

Hi,

Thank you for reporting this. Right now this library only support sequelize v3, and I think I will need some time to catch up with the version 4 because I haven't used sequelize in a while.

bartmanskyi commented 6 years ago

No problem. Thank you for the good lib. Everything work fine, except search

marcotuna commented 6 years ago

Hello, I installed sequelize version 3.33.0 but it's still not working. Neither searching or sorting.

Edit: Found the problem, I was passing the data as POST and receiving with req.body, I had to change to GET and use req.query

egisz commented 4 years ago

@alwint3r I propose to close this issue as it is solved.

Edit: Found the problem, I was passing the data as POST and receiving with req.body, I had to change to GET and use req.query