How to add custom classes to whole table, wrapper, thead, tbody, etc.

How to add custom classes to whole table, wrapper, thead, tbody, etc.

smittlessmittles Posts: 13Questions: 0Answers: 0
edited April 2012 in General
This has got to be a commonly asked question, but I don't see it explicitly exemplified anywhere. If I'm using, let's say, 3 tables on one page, and I want unique styling for them, and I'm using JQuery UI, I obviously need to be able to change or add classes at any level of the table.

Where is this process documented, and/ or how can I add classes to any / every element of a table using DataTables?

Replies

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Just add them to your HTML?

    [code]


    etc
    [/code]

    would that work for you?

    Allan
  • smittlessmittles Posts: 13Questions: 0Answers: 0
    I'm particularly interested in the , which I would like to render as hidden, or another color, or whatever. It seems that the footer bar at the bottom of some tables is breaking from the design spec given by the UI designer.

    I'd like to have utter control over the tables, and while I am declaring a thead and tbody, those other datatable elements are what I really want to get at.
  • pakypaky Posts: 106Questions: 0Answers: 0
    [code]
    $.fn.dataTableExt.oStdClasses.sWrapper = 'no-margin last-child';
    $.fn.dataTableExt.oStdClasses.sInfo = 'message no-margin';
    $.fn.dataTableExt.oStdClasses.sLength = 'float-left';
    $.fn.dataTableExt.oStdClasses.sFilter = 'float-right';
    $.fn.dataTableExt.oStdClasses.sPaging = 'sub-hover paging_';
    $.fn.dataTableExt.oStdClasses.sPagePrevEnabled = 'control-prev';
    $.fn.dataTableExt.oStdClasses.sPagePrevDisabled = 'control-prev disabled';
    /* etc.... */
    [/code]
  • smittlessmittles Posts: 13Questions: 0Answers: 0
    Paky, where are you getting those values?
  • smittlessmittles Posts: 13Questions: 0Answers: 0
    Or, better yet, the ability to add a class to the following div:
    [code]... [/code]
    to at least be able to scope the table filter section when there are more than one table on a page, and I want each table to be styled independently and still use ThemeRoller...
  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    > Paky, where are you getting those values?

    Styling section of the documentation: http://datatables.net/styling/custom_classes

    Allan
  • smittlessmittles Posts: 13Questions: 0Answers: 0
    So I should be able to substitute the "...oStdClasses..." with "...oJUIClasses..." without interfering with the automatically included JUI class assignments? Those classes would be added on to the JUI classes.
  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    oJUIClasses are used if you specify bJQueryUI:true, oStdClasses if you don't :-)

    Allan
This discussion has been closed.