File tree Expand file tree Collapse file tree 1 file changed +5
-9
lines changed
Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -269,18 +269,18 @@ <h1>
269269 } ;
270270
271271 if ( groupByColumnName ) {
272- config . order = [ [ groupByColumnName + ":name" , "asc" ] ] ;
272+ const colIndex = table . column ( groupByColumnName + ":name" ) . index ( )
273+ config . order = [ [ colIndex , "asc" ] ] ;
273274 config . rowGroup = {
274275 dataSrc : groupByColumnName === "status"
275276 ? ( row , type ) => {
276277 let table = $ ( "#table" ) . DataTable ( ) ;
277- let statusIndex = table . column ( "status:name" ) . index ( ) ;
278- let statusHtml = row [ statusIndex ] ;
278+ let statusHtml = row [ colIndex ] ;
279279
280280 // Find the corresponding DOM cell to get data-status attribute
281281 let tableRows = document . querySelectorAll ( "#table tbody tr" ) ;
282282 for ( let tableRow of tableRows ) {
283- let statusCell = tableRow . cells [ statusIndex ] ;
283+ let statusCell = tableRow . cells [ colIndex ] ;
284284 if ( statusCell && statusCell . innerHTML . trim ( ) === statusHtml . trim ( ) ) {
285285 return getDataStatusFromCell ( statusCell ) ;
286286 }
@@ -289,11 +289,7 @@ <h1>
289289 // Fallback to HTML content
290290 return statusHtml ;
291291 }
292- : ( row , type ) => {
293- let table = $ ( "#table" ) . DataTable ( ) ;
294- let colIndex = table . column ( groupByColumnName + ":name" ) . index ( ) ;
295- return row [ colIndex ] ;
296- }
292+ : colIndex
297293 } ;
298294 }
299295 return new DataTable ( "#table" , config ) ;
You can’t perform that action at this time.
0 commit comments