wenzhixin / bootstrap-table-examples

Bootstrap table examples
https://examples.bootstrap-table.com/
MIT License
2.24k stars 1.62k forks source link

Deal correctly with server side integer values #464

Closed albfan closed 1 year ago

albfan commented 2 years ago

https://github.com/wenzhixin/bootstrap-table-examples/blob/develop/server/examples.js#L39

Looks the server side fails for integer values:

https://examples.wenzhixin.net.cn/examples/bootstrap_table/data?limit=10&filter=%7B%22name%22%3A%220%22%7D

{"name":"0"}

works

but

https://examples.wenzhixin.net.cn/examples/bootstrap_table/data?limit=10&filter=%7B%22id%22%3A%220%22%7D

{"id":"0"}

shows:

TypeError: item[key].includes is not a function
   at /home/zhixin/www/blog/routes/examples.js:39:48
   at Array.filter (<anonymous>)
   at Object.data (/home/zhixin/www/blog/routes/examples.js:39:23)
   at module.exports (/home/zhixin/www/blog/routes/examples.js:81:48)
   at callbacks (/home/zhixin/www/blog/node_modules/express/lib/router/index.js:164:37)
   at param (/home/zhixin/www/blog/node_modules/express/lib/router/index.js:138:11)
   at param (/home/zhixin/www/blog/node_modules/express/lib/router/index.js:135:11)
   at param (/home/zhixin/www/blog/node_modules/express/lib/router/index.js:135:11)
   at pass (/home/zhixin/www/blog/node_modules/express/lib/router/index.js:145:5)
   at Router._dispatch (/home/zhixin/www/blog/node_modules/express/lib/router/index.js:173:5)

it is trying to use typical str includes for an integer

I will provide a PR to fix this, but not sure how to make that to be deployed

this comes from https://github.com/wenzhixin/bootstrap-table/issues/6030#issuecomment-1100854575