@@ -36,6 +36,7 @@ document.addEventListener("DOMContentLoaded", async () => {
3636 if ( renderFunctions [ colName ] ) {
3737 columnConfig . columns [ col ] . render = renderFunctions [ colName ] ;
3838 }
39+ columnConfig . columns [ col ] . footer = createColumnFooter ( ) . outerHTML ;
3940 }
4041
4142 const buttons = [
@@ -80,7 +81,6 @@ document.addEventListener("DOMContentLoaded", async () => {
8081 }
8182
8283 dataTable = new DataTable ( "#software-table" , {
83- responsive : true ,
8484 paging : true ,
8585 processing : false ,
8686 serverSide : true ,
@@ -90,14 +90,49 @@ document.addEventListener("DOMContentLoaded", async () => {
9090 stateSave : true ,
9191 ajax : {
9292 url : "/ui/bff/software" ,
93- data : ( data ) => {
94- // biome-ignore lint/performance/noDelete: really has to be deleted
95- delete data . columns ;
96- } ,
93+ method : "POST" ,
94+ submitAs : "json" ,
9795 contentType : "application/json" ,
9896 } ,
99- initComplete : ( ) => {
97+ initComplete : function ( ) {
10098 updateBtnState ( ) ;
99+ const api = this . api ( ) ;
100+
101+ columnConfig . columns . forEach ( ( col , idx ) => {
102+ if ( col . visible === false ) {
103+ return ;
104+ }
105+
106+ if ( col . searchable ) {
107+ const inputGroup = document . createElement ( "div" ) ;
108+ inputGroup . className = "input-group input-group-sm" ;
109+ inputGroup . style . width = "100%" ;
110+
111+ const column = api . column ( idx ) ;
112+
113+ const input = document . createElement ( "input" ) ;
114+ input . type = "text" ;
115+ input . placeholder = col . title ;
116+ input . value = column . search ( ) ;
117+ input . className = "form-control form-control-sm" ;
118+
119+ const iconSpan = document . createElement ( "span" ) ;
120+ iconSpan . className = "input-group-text" ;
121+ iconSpan . innerHTML = '<i class="bi bi-search"></i>' ; // Bootstrap icon
122+
123+ inputGroup . appendChild ( iconSpan ) ;
124+ inputGroup . appendChild ( input ) ;
125+
126+ input . addEventListener ( "input" , function ( ) {
127+ const column = api . column ( idx ) ;
128+ if ( column . search ( ) !== this . value ) {
129+ column . search ( this . value ) . draw ( ) ;
130+ }
131+ } ) ;
132+
133+ api . column ( idx ) . footer ( ) . replaceChildren ( inputGroup ) ;
134+ }
135+ } ) ;
101136 } ,
102137 columnDefs : [
103138 {
0 commit comments