use Pagination dataSource without edit to backend source
Summary use tui-pagination dataSource without edit to backend source, how can i change dataform before run parsing
Version grid : 4.13.0 pagination : 3.4.0
Additional context when i use tui-pagination with dataSource, i must change backend dataform.
but it canโt.
how can i change dataform without edit to backend source.
โโโโโโโโโโโโโโโโโโโโโโ
Toast Pagination์์ dataSource ์ฌ์ฉ์ ์ง์ ๋ ํํ๋ก ๊ฒฐ๊ณผ ๋ฐ์ดํฐ๋ฅผ ๋๊ฒจ์ฃผ์ด์ผ ์ ์ ๋์ํ์ง๋ง
๋ฐฑ์ค๋์ ๋ฐ์ดํฐ ํํ๋ฅผ ๋ฐ๊ฟ ์ ์๋ ๊ฒฝ์ฐ๋ผ์ api:readData์์ response๋ฅผ ์ฒ๋ฆฌํ๊ธฐ ์ ์ response์ ๋ฐ์ดํฐ ํํ๋ฅผ ๋ฐ๊ฟ์ฃผ๋ ค๊ณ ํฉ๋๋ค.
์ด ๊ฒฝ์ฐ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์์ค๋ฅผ ์ง์ ์์ ํ์ง ์๊ณ response์ ํํ๋ฅผ ๋ณ๊ฒฝ์์ผ์ค ๋ฐฉ๋ฒ์ด ์์๊น์?
์๋๋ ์ง์ ์๋ํด๋ณธ ๋ฐฉ๋ฒ๋ค์ ๋๋ค.
- dataSource๋ฅผ ์ฌ์ฉํ์ง ์๊ณ ์ง์ grid์ row๋ฅผ ๊ทธ๋ ค์ฃผ๊ณ pageOption๊ฐ์ ์ค์ ํด์ค๋ค
- ์ด ๊ฒฝ์ฐ ํ์ด์ง์ ๋ค๋น๊ฒ์ด์ ๋ฐ์์ ๋ฒํธ ํด๋ฆญ ์ ์ด๋ฒคํธ๊ฐ ๋์ํ์ง ์์ต๋๋ค. ( ๋ฐ์ดํฐ ์์ค์ api๋ฅผ ๊ตฌํํด์ผ ํ๋ค๊ณ ์ค๋ฅ๋ฐ์ )
- grid.on('response',ev => {}); ๋ฅผ ํตํด ์๋ต ์ ๋จผ์ ๋ฐ์ดํฐ๋ฅผ ๋ฐ์ ev.xhr.response ์ ev.xhr.responseText์ ๊ฐ์ ๋ณ๊ฒฝํด์ค๋ค.
- ์ด ๊ฒฝ์ฐ ev.xhr.response์ ev.xhr.responseText์ ๊ฐ์ด ๋ณ๊ฒฝ๋ถ๊ฐ๋ก ๋์ด์์ด ์ ์์ ์ผ๋ก ์์ ๋์ง ์์ต๋๋ค. ( Object.defineProperty ๋ฅผ ํตํด ๋ณ๊ฒฝํด๋ณด๋ ค ํ์ผ๋ ์ ์์ ์ผ๋ก ์์ ๋์ง ์์์ต๋๋ค.)
@Cronian
Have you tried editing ev.xhr.res._body?
@Cronian Have you tried editing
ev.xhr.res._body?
in my case, ev.xhr.res is not exist.. (Spring framework 4.3.29 & Tomcat 9.0)
This issue has been automatically marked as inactive because there hasnโt been much going on it lately. It is going to be closed after 7 days. Thanks!
This issue will be closed due to inactivity. Thanks for your contribution!
This issue will be closed due to inactivity. Thanks for your contribution!