Update Options on Existing jQuery Object
        Posted  
        
            by 
                Vince Kronlein
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Vince Kronlein
        
        
        
        Published on 2012-12-19T11:01:09Z
        Indexed on 
            2012/12/19
            11:03 UTC
        
        
        Read the original article
        Hit count: 303
        
I'm using Bootstrap and DataTables in my app and I have a default initializer for tables based on class. I can just add the class data-table to the table and it gets instantiated with the default values I want.
I'd like to know how to change or update specific options based on a specific table.
if ($.fn.dataTable) {
    $('.data-table').dataTable( {
        sDom: "R<'row'<'span6'l><'span6'f>r>t<'row'<'span6'i><'span6'p>>",
        sPaginationType: "bootstrap",
        oLanguage: {
            "sLengthMenu": "_MENU_   records per page"
        },
        aoColumnDefs: [
            { "bSortable": false, "aTargets": [ 0 ] }
        ]
    });
}
All my data tables have a checkbox in the first column so the above removal of sorting works for all of them. But I'd like to be able to update the aoColumnDefs on a table by table basis so I can add other columns that I don't want sorted.
So let's say I have a table: $('#member-list'), how do I access this object and update it's datatables options in jQuery? I can't find any reference or help anywhere.
Thanks a lot!
-V
© Stack Overflow or respective owner