You must Sign In to post a response.
  • Category: JQuery

    Redraw data table jquery

    Hi,

    How to redraw data table of jquery with new width. Pls find the code below. Need to redraw to 50% 50% width on button click.

    Thanks in advance.
    Rijesh

    var table = $('#example').DataTable( {
    scrollY: 300,
    scrollX: true,
    scrollCollapse: true,
    paging: false,
    fixedColumns: true,
    bFilter: false,
    bInfo: false,
    bAutoWidth: false ,
    aoColumns : [
    { sWidth: '25%' },
    { sWidth: '75%' }
    ]
    } );
  • #766375
    Hi,
    Try adding a CSS to your datatable:

    $('#xyz').dataTable(
    {
    "autoWidth": false
    } );

  • #766385
    you can use draw() method for it, Redraw the DataTables in the current context, optionally updating ordering, searching and paging as required. A draw is not performed automatically by most DataTables API actions to allow grouping of actions (for example adding multiple rows is more efficient if you group them. Keep in mind that due to the chaining nature of the DataTables API calling the draw()API method is just a case of adding .draw() to your other API method calls,
    use below link for more details
    https://datatables.net/reference/api/draw()

    Thanks
    Koolprasd2003
    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]


Sign In to post your comments