The New Layout Feature - THANK YOU!

The New Layout Feature - THANK YOU!

minifiredragonminifiredragon Posts: 82Questions: 16Answers: 2

That's all. Just a big thank you for this feature. In the past I had to do a bunch of jquery fuggery to move things into place. The new Layout feature is sooooo nice. Took me a few minutes to figure out how to get things in a line, but I got it!

And for those scratching your head, here is a quick note on the subject:

top:  Will spread your options across the top of the table, using the pageLength:, info: and search: 
(the old style of the table, atleast from my options) it looks weird.
topStart:  Will put your options nicely together.
topEnd:  Will put everthing to the right side (pretty much opposite of topStart).
div:  Now this is where the fun really is.  Using this, give it an id and append you extra buttons to it.  Sooo nice.

The piece that got me for a few minutes was how to include the menu options with info and search. The examples are good, but this one might help the lost:

I put this at the begining outside the DataTable initialize as per the example:
DataTable.defaults.layout =
{
   topStart: null,
   topEnd: null,
   bottomStart: null,
   bottomEnd: null
};


$(#example').DataTable(
{
   layout: {
      topStart:
      {
         pageLength: 
         { 
            menu: [[10, 25, 50, 500, 1000, -1], [10, 25, 50, 500, 1000, "All"]],   
            The only thing I am not sure is if you can set the default selection in here.  
            I did not see it in the pageLength documents, but the pageLength option still worked.
         },
         info: {},
         search : {},
         div: 
            {
               id: 'buttonBox,
            },                      
         },             
         bottom: ['info', 'paging'],
   },
});

And one last thing to remember, the top and bottom, when you place numbers after them, will count down, ie, top3 is 1st, top2 is next, etc..:

top3: Will be first
top2: Next
top1: Next
top: Bottom

top2Start: Can use the number between as well.

But anyway. Thanks for this lovely feature!!

Replies

  • allanallan Posts: 63,290Questions: 1Answers: 10,428 Site admin

    Thank you! I've just made my morning. What a great way to start the day!

    Allan

Sign In or Register to comment.