Skip to content

Get responsive instance from DT instance #65

Open

Description

@ebrahimradi

Hi
Can I get responsive instance from DataTables instance?
Thanks

Activity

  1. comanche commented on Apr 13, 2015

    @comanche
    Owner

    You may save the instance when you first initialize in preDrawCallback:

    'use strict';
    
    $(document).ready(function () {
        var breakpointDefinition = {
            tablet: 1024,
            phone : 480
        };
        var tableElement = $('#example');
    
        tableElement.dataTable({
            autoWidth      : false,
            ajax           : './arrays.txt',
            preDrawCallback: function () {
                // Initialize the responsive datatables helper once.
                if (!this.responsiveHelper) {
                    this.responsiveHelper = new ResponsiveDatatablesHelper(tableElement, breakpointDefinition);
                }
            },
            rowCallback    : function (nRow) {
                this.responsiveHelper.createExpandIcon(nRow);
            },
            drawCallback   : function (oSettings) {
                this.responsiveHelper.respond();
            }
        });
    });
  2. ebrahimradi commented on May 11, 2015

    @ebrahimradi
    Author

    Thanks.
    But I'm looking for retrieving instance from a function which contain just DataTable instance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions