Wednesday, May 8, 2024

Datatable Jquey

 Official Website

https://datatables.net/



How to create datatabel with Jquery

https://live.datatables.net/huwakohe/1/edit


How to bold the column in data table in UI

https://live.datatables.net/xeguvibi/1/edit

https://live.datatables.net/lohisusa/404/edit


How to bold the column text in excel file(export)

https://datatables.net/extensions/buttons/examples/html5/excelTextBold.html

https://live.datatables.net/jijumeji/1035/edit


How to color the entire column in excel file(export)

https://live.datatables.net/redorefa/49/edit


This means below row is A3 in sheet. r is row and A3 is column and row number

 $('c[r=A3]', sheet).attr('s', '7');

This means below , 0th row and c column to  bold

 $('row:eq(0) c', sheet).attr( 's', '2');


Built in cell text color and bgcolor 

https://datatables.net/reference/button/excelHtml5


or for bold column in excel, below code

customize: function (xlsx){

var sheet = xlsx.xl.worksheets['sheet1.xml'];

                            var boldCols = ['G'];

                            var rows = $('row', sheet); 

                            for (i = 2; i < rows.length; i++) {

                                debugger

                                for (y = 0; y < boldCols.length; y++) {

                                    $('row:eq(' + i + ') c[r^=' + boldCols[y] + ']', sheet).attr('s', '2');  //bold

                                    $('row:eq(' + i + ') c[r^="B"]', sheet).attr('s', '2,68');

                                }

                                

                            }

}

No comments:

Post a Comment