the sDom parameter
the sDom parameter
Hi Allan,
I don't fully understand the sDom syntax. Take your example:
"sDom": '<"top"i>rt<"bottom"flp><"clear">'
How do I read this?
I understand the letters as identifying parts of the table elements, but
< and > - div elements
<"class" and > - div with a class
is really not clear to me!
Thanks,
Martin
I don't fully understand the sDom syntax. Take your example:
"sDom": '<"top"i>rt<"bottom"flp><"clear">'
How do I read this?
I understand the letters as identifying parts of the table elements, but
< and > - div elements
<"class" and > - div with a class
is really not clear to me!
Thanks,
Martin
This discussion has been closed.
Replies
The sDom syntax is a little bit obscure at first glance. I've done it this way in order to keep it concise. Possibly the best way of thinking of it is that
'<' gives ''
'<"class"' gives ''
'>' gives ''
So the example above is really:
[code]
i
rt
flp
[/code]
Does this help to understand it better?
Allan
Thanks, that helped!
I initially thought that the divs referred to existing divs, but now I understand that the datatable actually injects these divs are the given position.
Martin
It looks like you can render the pager twice, but not the info. I need to render both twice. Thus:
"sDom": '<"pager"p>t<"pager"p><"info"i><"clear">',
works but
"sDom": '<"info"i><"pager"p>t<"info"i><"pager"p><"clear">',
does not render the info section twice.
Neither does something simpler:
"sDom": '<"pager"ip>t<"pager"ip><"clear">',
Any ideas why?
Thanks,
Rendering elements twice (pager, info etc) is not supported in the built-in DataTables DOM handling. If you want to do this you need to either use the API, or modify the source code. The API will certainly help with the paging, but there isn't really a method to deal with the info element directly. What you could do is use the fnDrawCallback() function and update other elements on the page as you see fit.
Regards,
Allan
The default is given in the documentation: http://datatables.net/usage/options#sDom (click on the "Show Details" link).
Regards,
Allan
I'm trying to place the filter input inside a caption element I have in my table, is that possible with sDom?
Allan
To make that caption row be first (actually, the filter row be second), I use this litle jq script:
[code]$('#rowFilters').next().after($('#rowFilters'));[/code]
hth
Many thanks,
John
However, what you can do is simply move the generated elements from there generated position to somewhere else in the DOM after the initialisation is complete with standard jQuery / DOM methods (i.e. append / appendChild).
Allan
"sDom": 'C<"clear">lfrtip',
"sDom": 'T<"clear">lfrtip',
Is there a way to fix the alignment using this?
Thank you!
Darcy
> sDom: 'CTlfrtip'
Just TableTools and all the standard DataTables features:
> sDom: 'Tlfrtip'
Just the table a filtering:
> sDom: 'ft'
The angle brackets allow an element to be injected, which can be useful, but isn't required.
That puts the feature elements into the DOM in that order. Then you can simply position them using standard CSS - float:left etc.
Allan
Thank's for your post it help me, I have done like this:
[code]sDom: 'CT<"clear">lfrtip',[/code]
Allan
Allan
"sDom" : 'T<"clear">lfrtip',
I want colvis at left and tabletools at right...how can this be obtained..like
[colvis]..........................[tabletools]
....................................[search]
Allan
//sDom: 'TClfrtip',
I want Colvis in the left most side and Tabletools in the rightmost side....
Also after using
"sDom": 'TC<"clear">lfrtip',
After unticking some checkbox, now the background becomes LOCKED, i cannot click the page.. :(
BTW, I have a really big no. of columns..probably around 40 columns...
TypeError: jQuery.browser is undefined
[Break On This Error]
if ( jQuery.browser.msie && jQuery.browser.version == "6.0" )
ColVis.js (line 856) <- error in this line
I am using Firefox23.0
// if ( jQuery.browser.msie && jQuery.browser.version == "6.0" )
if ( jQuery.support.boxModel )
{
that._fnDrawCallback();
}
since jQuery.browser has been discontinued, just to pass I used this code, dont know what actually its for. But I guess it's there to check the Microsoft Internet Exploerer version...
Although it seems to solve the issue...
But from discusstion
https://github.com/DataTables/ColVis/pull/16
and
http://datatables.net/forums/discussion/13528/datatable-1.9.4-colreorder-cannot-call-method-proxy-of-undefined/p1
its seems that it was solved but I think it isnt...I've just pulled codes some days ago..(23rd Aug 2013, Datables version 1.9.3)
Please fix the issue...
By the way....NICE jquery library.... CHEERS :)