sClass not working
sClass not working
easymind
Posts: 6Questions: 0Answers: 0
Hi, I have experimented with version 1.4.2 of your seemingly great tool.
I am having trouble though getting sClass to work.
As far as I can tell you draw tr objects that are gathered on initialization.
I cannot find the code that handles the sClass variable.
So I have added this to the bottom of the 'process by column' loop in your _fnGatherData function:
/* Add sClass */
if ( oSettings.aoColumns[i].sClass !== null )
{
iLoop = oSettings.aoData.length;
for ( j=0 ; j
I am having trouble though getting sClass to work.
As far as I can tell you draw tr objects that are gathered on initialization.
I cannot find the code that handles the sClass variable.
So I have added this to the bottom of the 'process by column' loop in your _fnGatherData function:
/* Add sClass */
if ( oSettings.aoColumns[i].sClass !== null )
{
iLoop = oSettings.aoData.length;
for ( j=0 ; j
This discussion has been closed.
Replies
/* Add sClass */
if ( oSettings.aoColumns[i].sClass !== null )
{
nThOriginals[i].className += " "+oSettings.aoColumns[i].sClass;
}
Good catch - thanks for spotting this. It was only working on table rows that were created by DataTables as things stood.
I've made a fix for this and done a bit of optimisation work in _fnGetherData() now (there was a lot of loops...) so that should see a bit of a speed benefit when using custom column attributes in future. This will be out with 1.4.3, but great that you've posted your fix for 1.4.2 - thanks!
One thing to note - I hadn't really intended 'sClass' to be applied to the th elements, but only to the td cells. I think I'll leave it to the developer to add a class to th if they want something over and above what is in the DOM.
Allan
I don't know if I agree with the header being skipped for classes since one could then optionally not define a th.sClass but only a td.sClass style.
For me, I generate header cells and table cells from code. So inserting a class on a specific th cell with your js code is better for me. Now I can easily center the whole column without having to mess with my data in my own controller...
Anyways, thanx for replying and keep it up.