Unpacking datatables definitions or reusing them for commonly set values

Unpacking datatables definitions or reusing them for commonly set values

FranckyVeeFranckyVee Posts: 1Questions: 1Answers: 0

Hey,

I'm using a LOT of different datatables in my current project, but most share the same set of default attributes. For instance:

poclosed_detcmd_potdetails_table = $('#poclosed_partsonorder_table').DataTable({
    "scrollY":        "300px",                                
    "scrollCollapse": false,                                   
    "paging": true,
    "pageLength": 50,
    "searching": true,                                         
    "info": true,                                          
    "cache":false,
    "aaSorting":[],                                                                    
    "deferRender":true,                                     
    ..... more code ..... 

Is there a way to store those as an object for example, and unpack the object into the Datatable one? Or failing that set a generic default and inherit from it?

Thanks!

Franck

Answers

  • kthorngrenkthorngren Posts: 21,341Questions: 26Answers: 4,954

    You can set defaults as shown in this doc.

    Kevin

Sign In or Register to comment.