728x90
๋ฐ˜์‘ํ˜•

datatables 6

[jQuery][datatables] ์—‘์…€ ๋‹ค์šด๋กœ๋“œ

$('#myTable').DataTable( { buttons: [ { extend: 'excel', text: 'Save current page', exportOptions: { modifier: { page: 'current' } } } ] } ); ํ”„๋กœ์ ํŠธ์—์„œ๋Š” ์—‘์…€ ๋‹ค์šด๋กœ๋“œ์‹œ ์ปฌ๋Ÿผ๋ณ„๋กœ CSS๋ฅผ ์„ค์ •ํ•ด์ฃผ๊ณ , function getExcelConfig(){ // ์—‘์…€ ์Šคํƒ€์ผ ์„ค์ • const cols = [ // ์ˆœ์„œ { idx:0, stCode :'center' }, // ์ผ์ž { idx: 1, stCode :'center', width: 40 }, // ๊ตฌ๋ถ„ { idx: 2, stCode:'center' }, // ๋น„๊ณ  { idx: 3, stCode:'left', width: 50 } ]; // s..

Front/JS & jQuery 2022.08.03

[jQuery][datatables] columnDefs . width

Ex $('#table').DataTable({ columnDefs : [ ,{ "width": "10%", "targets": [2,3,4] } ,{ "width": "15%", "targets": [1] } ] โžก targets๋กœ ์„ค์ •๋œ ์—ด์˜ ๋„ˆ๋น„๋ฅผ ์„ค์ •ํ•ด์ค€๋‹ค. https://datatables.net/reference/option/columns.width columns.width columns.width Since: DataTables 1.10 Column width assignment. Description This parameter can be used to define the width of a column, and may take any CSS value (3em, 20px etc). Ple..

Front/JS & jQuery 2022.06.05

[Error][datatables]uncaught (in promise) typeerror: cannot read properties of undefined (reading 'style')

datatables๋ฅผ ์ด์šฉํ•ด์„œ ํ…Œ์ด๋ธ”์„ ๊ทธ๋ฆฌ๋Š”๋ฐ ์ž๊พธ ์•„๋ž˜์™€ ๊ฐ™์€ ์—๋Ÿฌ๊ฐ€ ๋–ด๋‹ค. uncaught (in promise) typeerror: cannot read properties of undefined (reading 'style') ๊ตฌ๊ธ€๋ง ํ•ด๋ณธ๊ฒฐ๊ณผ ํ—ค๋”์ธ ๊ฐœ์ˆ˜์™€ ๋‚ด๊ฐ€ ๋ถˆ๋Ÿฌ์˜ค๋Š” ๋ฐ์ดํ„ฐ์˜ ์—ด๊ฐœ์ˆ˜๊ฐ€ ๋งž์ง€ ์•Š์•„์„œ ๋ฐœ์ƒํ•˜๋Š” ์—๋Ÿฌ๋ฉ”์„ธ์ง€๋ผ๋Š”๋ฐ ๋ถ„๋ช… ์—ด์˜ ๊ฐœ์ˆ˜๊ฐ€ ๋˜‘๊ฐ™์€๋ฐ ์™œ ์•ˆ๋œฐ๊นŒ ๊ณ„์† ์ฐพ์•„๋ดค๋Š”๋ฐ, colspan ๋•Œ๋ฌธ์ด๋ผ๋Š” ๊ธ€์„ ์ฐพ๊ฒŒ ๋˜์—ˆ๋‹ค.colspan์œผ๋กœ ์„ค์ •ํ•œ ๊ฒƒ ํฌํ•จํ•ด์„œ ์—ด์˜ ๊ฐœ์ˆ˜๊ฐ€ ๋งž์•˜๋˜ ๊ฑฐ์˜€๋Š”๋ฐ ์—†์• ๊ณ  ๊ฐœ๋ณ„๋กœ ์ž‘์„ฑํ•˜๋‹ˆ ์ •์ƒ์ ์œผ๋กœ ์ž‘๋™๋˜์—ˆ๋‹ค.

Error 2022.06.01

[Error][jQuery][datatables] datatables.bundle.js:9358 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'parentNode')

datatables๋ฅผ ์‚ฌ์šฉํ•ด์„œ ํŽ˜์ด์ง€๋ฅผ ๋งŒ๋“ค๋‹ค๊ฐ€ ์œ„์™€ ๊ฐ™์€ ์˜ค๋ฅ˜๊ฐ€ ๋‚ฌ๋‹ค. ์›์ธ : columns์˜ data ๊ฐœ์ˆ˜ ( ์—ด์˜ ๊ฐœ์ˆ˜ )๊ฐ€ ๋งž์ง€ ์•Š์„ ๋•Œ โžก๏ธ ์ด ๊ฒฝ์šฐ๊ฐ€ ์ œ์ผ ๋งŽ์€ ๊ฑฐ ๊ฐ™๋‹ค. ๊ตฌ๊ธ€๋งํ•ด๋ณธ ๊ฒฐ๊ณผ ! ๋“ค์–ด์˜ค๋Š” ๋ฐ์ดํ„ฐ ๊ฐ’์ด ์—†์„ ๋•Œ ๋ฐ์ดํ„ฐ ๋ Œ๋”๋ง ๊ณผ์ •์—์„œ ๋ฐ์ดํ„ฐ๋ฅผ ๋„ฃ์–ด์ฃผ๋Š” ๋ฐฉ๋ฒ•์„ ์‚ฌ์šฉํ•˜์˜€๋‹ค. ,{ className : "txr", "targets" : [6, 7], render : function ( data, type, row ) { if (data) { data= data.toFixed(1); } else { data = 0; } return data+ '%'; }, tfoot : true, }

Error 2022.05.24
728x90
๋ฐ˜์‘ํ˜•