jquery datatables: how to stop it from adding 'odd' or 'even' to class name





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







6















This is all I'm using for datatable...



  $("#resultsTable").dataTable({
dom:'Blfrtip',
buttons: [
'excelHtml5',
'csvHtml5',
'pdfHtml5'
],

"fnPreDrawCallback":function(){
$("#resultsTable").hide();
//alert("Pre Draw");
},
"fnDrawCallback":function(){
$("#resultsTable").show();
//alert("Draw");
},
"fnInitComplete":function(){
//alert("Complete");
}
});


But is adds 'odd' or 'even' to the calss name of each row it seems, which I do NOT want. How can I get it to leave the class names alone?










share|improve this question























  • Couldn't you just do a $("#resultsTable tr").removeClass( "odd even" )?

    – j08691
    May 25 '16 at 21:18











  • Why are the extra classes bothering you in the first place?

    – DarkBee
    May 25 '16 at 21:20






  • 3





    Here is how btw : datatables.net/reference/option/stripeClasses

    – DarkBee
    May 25 '16 at 21:22











  • Thanks for helping me find that. stripeClasses was not on my radar.

    – user2782001
    May 25 '16 at 21:28


















6















This is all I'm using for datatable...



  $("#resultsTable").dataTable({
dom:'Blfrtip',
buttons: [
'excelHtml5',
'csvHtml5',
'pdfHtml5'
],

"fnPreDrawCallback":function(){
$("#resultsTable").hide();
//alert("Pre Draw");
},
"fnDrawCallback":function(){
$("#resultsTable").show();
//alert("Draw");
},
"fnInitComplete":function(){
//alert("Complete");
}
});


But is adds 'odd' or 'even' to the calss name of each row it seems, which I do NOT want. How can I get it to leave the class names alone?










share|improve this question























  • Couldn't you just do a $("#resultsTable tr").removeClass( "odd even" )?

    – j08691
    May 25 '16 at 21:18











  • Why are the extra classes bothering you in the first place?

    – DarkBee
    May 25 '16 at 21:20






  • 3





    Here is how btw : datatables.net/reference/option/stripeClasses

    – DarkBee
    May 25 '16 at 21:22











  • Thanks for helping me find that. stripeClasses was not on my radar.

    – user2782001
    May 25 '16 at 21:28














6












6








6








This is all I'm using for datatable...



  $("#resultsTable").dataTable({
dom:'Blfrtip',
buttons: [
'excelHtml5',
'csvHtml5',
'pdfHtml5'
],

"fnPreDrawCallback":function(){
$("#resultsTable").hide();
//alert("Pre Draw");
},
"fnDrawCallback":function(){
$("#resultsTable").show();
//alert("Draw");
},
"fnInitComplete":function(){
//alert("Complete");
}
});


But is adds 'odd' or 'even' to the calss name of each row it seems, which I do NOT want. How can I get it to leave the class names alone?










share|improve this question














This is all I'm using for datatable...



  $("#resultsTable").dataTable({
dom:'Blfrtip',
buttons: [
'excelHtml5',
'csvHtml5',
'pdfHtml5'
],

"fnPreDrawCallback":function(){
$("#resultsTable").hide();
//alert("Pre Draw");
},
"fnDrawCallback":function(){
$("#resultsTable").show();
//alert("Draw");
},
"fnInitComplete":function(){
//alert("Complete");
}
});


But is adds 'odd' or 'even' to the calss name of each row it seems, which I do NOT want. How can I get it to leave the class names alone?







jquery datatables






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked May 25 '16 at 21:14









user2782001user2782001

1,6491122




1,6491122













  • Couldn't you just do a $("#resultsTable tr").removeClass( "odd even" )?

    – j08691
    May 25 '16 at 21:18











  • Why are the extra classes bothering you in the first place?

    – DarkBee
    May 25 '16 at 21:20






  • 3





    Here is how btw : datatables.net/reference/option/stripeClasses

    – DarkBee
    May 25 '16 at 21:22











  • Thanks for helping me find that. stripeClasses was not on my radar.

    – user2782001
    May 25 '16 at 21:28



















  • Couldn't you just do a $("#resultsTable tr").removeClass( "odd even" )?

    – j08691
    May 25 '16 at 21:18











  • Why are the extra classes bothering you in the first place?

    – DarkBee
    May 25 '16 at 21:20






  • 3





    Here is how btw : datatables.net/reference/option/stripeClasses

    – DarkBee
    May 25 '16 at 21:22











  • Thanks for helping me find that. stripeClasses was not on my radar.

    – user2782001
    May 25 '16 at 21:28

















Couldn't you just do a $("#resultsTable tr").removeClass( "odd even" )?

– j08691
May 25 '16 at 21:18





Couldn't you just do a $("#resultsTable tr").removeClass( "odd even" )?

– j08691
May 25 '16 at 21:18













Why are the extra classes bothering you in the first place?

– DarkBee
May 25 '16 at 21:20





Why are the extra classes bothering you in the first place?

– DarkBee
May 25 '16 at 21:20




3




3





Here is how btw : datatables.net/reference/option/stripeClasses

– DarkBee
May 25 '16 at 21:22





Here is how btw : datatables.net/reference/option/stripeClasses

– DarkBee
May 25 '16 at 21:22













Thanks for helping me find that. stripeClasses was not on my radar.

– user2782001
May 25 '16 at 21:28





Thanks for helping me find that. stripeClasses was not on my radar.

– user2782001
May 25 '16 at 21:28












2 Answers
2






active

oldest

votes


















12














If you want to remove stripe classes globally, set the default options:



$.extend($.fn.dataTable.ext.classes, {
sStripeEven: '', sStripeOdd: ''
});


If you want to disable the classes during initialization:



$('#example').dataTable( {
"stripeClasses":
} );


If you want to disable them on the table directly via data attributes:



<table data-stripe-classes="">
</table>





share|improve this answer
























  • I was looking high and low. Disabling during initialization is exactly what I needed to fake it out. I wanted stripes displayed before sorting and match stripes after sorting. Thank you very much!

    – Grant Bowman
    Oct 11 '17 at 19:22





















1














I added "stripeClasses": but it had no effect. I had to remove "table-striped" in the list of classes in the table element used to create this data table. For instance, if you have a list of classes like this:



<table class="display table table-striped table-bordered dt-responsive">


simply delete table-striped.






share|improve this answer


























  • This works for a jQuery DataTable version 1.10 using Bootstrap 4.0. It was the correct answer for me so I don't know why it was downvoted.

    – DavidHyogo
    Jan 29 at 15:17











  • so difficult to understand some developers :)

    – Isa Ataseven
    Jan 31 at 13:44












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f37447738%2fjquery-datatables-how-to-stop-it-from-adding-odd-or-even-to-class-name%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









12














If you want to remove stripe classes globally, set the default options:



$.extend($.fn.dataTable.ext.classes, {
sStripeEven: '', sStripeOdd: ''
});


If you want to disable the classes during initialization:



$('#example').dataTable( {
"stripeClasses":
} );


If you want to disable them on the table directly via data attributes:



<table data-stripe-classes="">
</table>





share|improve this answer
























  • I was looking high and low. Disabling during initialization is exactly what I needed to fake it out. I wanted stripes displayed before sorting and match stripes after sorting. Thank you very much!

    – Grant Bowman
    Oct 11 '17 at 19:22


















12














If you want to remove stripe classes globally, set the default options:



$.extend($.fn.dataTable.ext.classes, {
sStripeEven: '', sStripeOdd: ''
});


If you want to disable the classes during initialization:



$('#example').dataTable( {
"stripeClasses":
} );


If you want to disable them on the table directly via data attributes:



<table data-stripe-classes="">
</table>





share|improve this answer
























  • I was looking high and low. Disabling during initialization is exactly what I needed to fake it out. I wanted stripes displayed before sorting and match stripes after sorting. Thank you very much!

    – Grant Bowman
    Oct 11 '17 at 19:22
















12












12








12







If you want to remove stripe classes globally, set the default options:



$.extend($.fn.dataTable.ext.classes, {
sStripeEven: '', sStripeOdd: ''
});


If you want to disable the classes during initialization:



$('#example').dataTable( {
"stripeClasses":
} );


If you want to disable them on the table directly via data attributes:



<table data-stripe-classes="">
</table>





share|improve this answer













If you want to remove stripe classes globally, set the default options:



$.extend($.fn.dataTable.ext.classes, {
sStripeEven: '', sStripeOdd: ''
});


If you want to disable the classes during initialization:



$('#example').dataTable( {
"stripeClasses":
} );


If you want to disable them on the table directly via data attributes:



<table data-stripe-classes="">
</table>






share|improve this answer












share|improve this answer



share|improve this answer










answered Feb 28 '17 at 15:49









akaspickakaspick

542611




542611













  • I was looking high and low. Disabling during initialization is exactly what I needed to fake it out. I wanted stripes displayed before sorting and match stripes after sorting. Thank you very much!

    – Grant Bowman
    Oct 11 '17 at 19:22





















  • I was looking high and low. Disabling during initialization is exactly what I needed to fake it out. I wanted stripes displayed before sorting and match stripes after sorting. Thank you very much!

    – Grant Bowman
    Oct 11 '17 at 19:22



















I was looking high and low. Disabling during initialization is exactly what I needed to fake it out. I wanted stripes displayed before sorting and match stripes after sorting. Thank you very much!

– Grant Bowman
Oct 11 '17 at 19:22







I was looking high and low. Disabling during initialization is exactly what I needed to fake it out. I wanted stripes displayed before sorting and match stripes after sorting. Thank you very much!

– Grant Bowman
Oct 11 '17 at 19:22















1














I added "stripeClasses": but it had no effect. I had to remove "table-striped" in the list of classes in the table element used to create this data table. For instance, if you have a list of classes like this:



<table class="display table table-striped table-bordered dt-responsive">


simply delete table-striped.






share|improve this answer


























  • This works for a jQuery DataTable version 1.10 using Bootstrap 4.0. It was the correct answer for me so I don't know why it was downvoted.

    – DavidHyogo
    Jan 29 at 15:17











  • so difficult to understand some developers :)

    – Isa Ataseven
    Jan 31 at 13:44
















1














I added "stripeClasses": but it had no effect. I had to remove "table-striped" in the list of classes in the table element used to create this data table. For instance, if you have a list of classes like this:



<table class="display table table-striped table-bordered dt-responsive">


simply delete table-striped.






share|improve this answer


























  • This works for a jQuery DataTable version 1.10 using Bootstrap 4.0. It was the correct answer for me so I don't know why it was downvoted.

    – DavidHyogo
    Jan 29 at 15:17











  • so difficult to understand some developers :)

    – Isa Ataseven
    Jan 31 at 13:44














1












1








1







I added "stripeClasses": but it had no effect. I had to remove "table-striped" in the list of classes in the table element used to create this data table. For instance, if you have a list of classes like this:



<table class="display table table-striped table-bordered dt-responsive">


simply delete table-striped.






share|improve this answer















I added "stripeClasses": but it had no effect. I had to remove "table-striped" in the list of classes in the table element used to create this data table. For instance, if you have a list of classes like this:



<table class="display table table-striped table-bordered dt-responsive">


simply delete table-striped.







share|improve this answer














share|improve this answer



share|improve this answer








edited Jan 29 at 17:53









DavidHyogo

1,66022235




1,66022235










answered Nov 15 '18 at 12:43









Isa AtasevenIsa Ataseven

363




363













  • This works for a jQuery DataTable version 1.10 using Bootstrap 4.0. It was the correct answer for me so I don't know why it was downvoted.

    – DavidHyogo
    Jan 29 at 15:17











  • so difficult to understand some developers :)

    – Isa Ataseven
    Jan 31 at 13:44



















  • This works for a jQuery DataTable version 1.10 using Bootstrap 4.0. It was the correct answer for me so I don't know why it was downvoted.

    – DavidHyogo
    Jan 29 at 15:17











  • so difficult to understand some developers :)

    – Isa Ataseven
    Jan 31 at 13:44

















This works for a jQuery DataTable version 1.10 using Bootstrap 4.0. It was the correct answer for me so I don't know why it was downvoted.

– DavidHyogo
Jan 29 at 15:17





This works for a jQuery DataTable version 1.10 using Bootstrap 4.0. It was the correct answer for me so I don't know why it was downvoted.

– DavidHyogo
Jan 29 at 15:17













so difficult to understand some developers :)

– Isa Ataseven
Jan 31 at 13:44





so difficult to understand some developers :)

– Isa Ataseven
Jan 31 at 13:44


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f37447738%2fjquery-datatables-how-to-stop-it-from-adding-odd-or-even-to-class-name%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Xamarin.iOS Cant Deploy on Iphone

Glorious Revolution

Dulmage-Mendelsohn matrix decomposition in Python