style issue while loading data to datatable

style issue while loading data to datatable

kumarmca.uppkumarmca.upp Posts: 7Questions: 1Answers: 0

this is my datatable, im dynamically loading data

var datatableVariable = $('#table_id').DataTable({

                        //colReorder: true,
                        //lengthMenu: [
                        //            [10, 25, 50],
                        //            ['10 rows', '25 rows', '50 rows']//, 'Show all'
                        //],

                        paging: false,
                        //"bPaginate": true,//24-apr
                        //"bAutoWidth": true,
                        "filter": false,
                        destroy: true,
                        searching: false,
                        "data": res            ,// MY DATA
                        "aoColumnDefs": aryJSONColTable,
                        "aoColumns": aryJSONCollumn,
                        //dom: 'Bfrtip',
                        //dom: 'lBfrtip',
                        buttons: [{
                            extend: 'csv',
                            text: 'To CSV',
                        },
                                    //{
                                    //    extend: 'copy',
                                    //    text: 'To clipboard'
                                    //},
                                    {
                                        extend: 'excel',
                                        text: 'To Excel',
                                    }, ]

                    });

my html

@model Anglian.ViewModel.UserModel

@{
ViewBag.Title = "DataTable";
Layout = "~/Views/Layouts/_LayoutPostLogin.cshtml";
}

Reports

Select a Category User Management Error Logs Usage Select a Report @*

*@

@*

Replies

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    What exactly is your problem?

  • kumarmca.uppkumarmca.upp Posts: 7Questions: 1Answers: 0

    $('#btnSQLSubmit').click(function () {

    var datatableVariable = $('#table_id').DataTable();

                        datatableVariable.destroy();
                        $('#table_id').empty();
    

    datatableVariable = $('#table_id').DataTable({
    data": res,
    "aoColumnDefs": aryJSONColTable,
    "aoColumns": aryJSONCollumn

    });
    });

    datatable not reinitialising here....dynamically loading different tabels...but if column changing times exixting table should destroy...but here not

  • allanallan Posts: 63,356Questions: 1Answers: 10,444 Site admin

    Can you link to a page showing the issue so it can be debugged please?

    Thanks,
    Allan

This discussion has been closed.