How to set a property dynamically using javascript on oTable

How to set a property dynamically using javascript on oTable

lgupta1lgupta1 Posts: 5Questions: 0Answers: 0
edited December 2012 in General
I have a page with many DataTable objects in it. They all have a class "testAbcd" associated with them.

I am able to get all these objects using document.getElementsByClassName("testAbcd").

I am then iterating over these objects and need to set the value of the attribute 'sPaginationType' dynamically based on some conditions.

How can I achieve this? i.e. set the value of an attribute on the DataTable object.

Thanks

Replies

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    How are you initialising the DataTable? You'd just add a condition based on that. Perhaps something like:

    [code]
    if ( pagingFull ) {
    $(node).dataTable( { sPaginationType: 'full_numbers' } );
    }
    else {
    // ... etc
    }
    [/code]

    Allan
This discussion has been closed.