grid layout - show custom div behind a feature element
grid layout - show custom div behind a feature element
in DataTables 2
How can I insert a custom div directly after the layout element paging?
Currently, it is displayed as a separate cell in the grid.
https://live.datatables.net/mijifezi/1/edit?html,css,output
<div class="dt-layout-row">
<div class="dt-layout-cell dt-layout-full"></div>
<div class="dt-length"></div>
<div class="custom-div">hallo</div>
<div class="dt-search"></div>
</div>
current

what i want

This question has accepted answers - jump to:
Answers
https://live.datatables.net/mijifezi/2/edit
Use
topLeftandtopRightto get the left and right cells. From there, the key piece of information is thattopStart(etc) can be given as an array:Use
topif you want multiple cells all spaced out. See this example for a more visual explanation.Allan
Thanks for the quick reply!
Can I also use two div elements by combining
topStartandtopEnd, and center the last div?https://live.datatables.net/mijifezi/3/edit
Or would it be better to use multiple div elements within with
topinstead?https://live.datatables.net/mijifezi/4/edit
https://live.datatables.net/mijifezi/5/edit
You can't have two properties called
divin an object. (or indeed any two properties with the same name).Do to that, you need to use the
features: []array approach where each entry is defined independently. Its a bit more verbose, but it allows the same feature type to be reused.Allan
OK, I understand that now – thank you.
Ich migriere gerade von dt 1.10 nach 2.3
Die alte
domoption habe ich durch die neuelayoutoption ersetztI am currently migrating from dt 1.10 to 2.3.
I have replaced the old
domoption with the newlayoutoption.This is what the display currently looks like with dt 2.3

This is how it should look (old display with dt 1.10)

I need a div tag in the middle of the empty area.
Why? It doesn't look like there is anything there.
There isn't a built in option to put a filler div there. You'd need to add an extra div in the features array (probably for
top) and alter the layout's CSS.Allan
Just to clarify, the div is not empty. The image is only meant to illustrate the schematic layout.
An additional text should be displayed in the center of the available space.
Here’s the design with DataTables 1.10

Ah - Thank you for the extra information. You will still need a little extra CSS, but it is a trivial line:
margin: 0 autofor the div in question: https://live.datatables.net/mijifezi/8/edit .Allan
Thank you very much, that's exactly what I was looking for.
One last question, if I may.
why is it not possible to set the
idattribute for the option elements? (in our exampledt-length)At the moment, I solve it as follows (there is only one
lengthelement)$jq('#jqdatatable_wrapper').find('.dt-length').attr('id', 'jqdatatable_length');In DataTables 1.10, the
idattribute is automatically set to 'jqdatatable_length'.Because it wasn't necessary. Moreover, if you had multiple instances of the same feature (i.e. a page length control above and below the table), then you'd have one with an id and one without.
What do you need the id for? As you say, the way to add it is with a quick query.
Allan
A few CSS adjustments — I often used the
idattribute here.Of course, it can also be done using a CSS selector. It was more of a question for understanding.
Yup - use a class name for that sort of adjustment. Apologies for the extra work that will create for you for the transition!
Allan