How can i change my buttons color please help me :(

How can i change my buttons color please help me :(

dnepomuceno101dnepomuceno101 Posts: 31Questions: 4Answers: 0
var dStudALl = $('#deanstudundr').DataTable( { responsive: true,}); new $.fn.dataTable.Buttons( dStudALl, { buttons: [{ extend: 'pdfHtml5', className: "btn-sm btn-primary btn-rounded", text: 'PDF', }, { extend: 'excelHtml5', className: "btn-sm btn-primary btn-rounded", text: 'EXCEL', }, { extend: 'print', className: "btn-sm btn-primary btn-rounded", text: 'PRINT', } ] } ); dStudALl.buttons().container() .appendTo( $(dStudALl.table().container() ) );

Answers

  • JuJoGuAlJuJoGuAl Posts: 32Questions: 2Answers: 0

    if you wanna define a primary class for all bottons use:

        buttons: {
            dom: {
                button: {
                    className: 'btn btn-outline-info mr-2' //Primary class for all buttons
                }
            },
            buttons: [                   
                {
                    //EXCEL
                    extend: 'excelHtml5', //extend the buttons that u wanna use
                }
            ]
        }
    

    With the DOM u can define the class to all your buttons

  • dnepomuceno101dnepomuceno101 Posts: 31Questions: 4Answers: 0
    edited February 2020

    ok

  • JuJoGuAlJuJoGuAl Posts: 32Questions: 2Answers: 0

    if you see the manual:

    you can control the tags used and the class names. You can also optionally control the structure of the markup for the buttons

    https://datatables.net/reference/option/buttons.dom

    That means you can define you own class for the buttons, and then invoque the buttons that u will use, show me the full code

  • dnepomuceno101dnepomuceno101 Posts: 31Questions: 4Answers: 0

    can u tell me wheres the css for this button it really hides my button idk why

  • dnepomuceno101dnepomuceno101 Posts: 31Questions: 4Answers: 0

    can i change it in buttons.bootstrap4.js directly?

  • JuJoGuAlJuJoGuAl Posts: 32Questions: 2Answers: 0

    is better put all your Data Table CODE here to understand your problem

  • dnepomuceno101dnepomuceno101 Posts: 31Questions: 4Answers: 0


  • dnepomuceno101dnepomuceno101 Posts: 31Questions: 4Answers: 0


    here it work if i put btn light but if i use btn-primary it default to secondary

  • JuJoGuAlJuJoGuAl Posts: 32Questions: 2Answers: 0

    I guess it will work:

    jQuery(function () {
        jQuery('#teachListReq').DataTable({
            responsive: true,
            buttons: {
                dom: {
                    button: {
                        className: 'btn btn-light btn-sm btn-rounded'
                    }
                },
                buttons: [
                    {
                        //EXCEL
                        extend: 'excelHtml5',
                        //text: '<i class="fas fa-file-excel"></i> EXCEL', //u can define a diferent text or icon
                        title: 'Student Letter Request List',
                    },
                    {
                        //PRINT
                        extend: 'print',
                        //text: '<i class="fas fa-print"></i> IMPRIMIR',
                        title: 'Student Letter Request List',
                    },
                    {
                        //COPY
                        extend: 'copy',
                        //text: '<i class="fas fa-print"></i> IMPRIMIR',
                        title: 'Student Letter Request List',
                    }
                ]
            },
        });
    });
    
  • dnepomuceno101dnepomuceno101 Posts: 31Questions: 4Answers: 0

    it hides my button sir :( why?

  • dnepomuceno101dnepomuceno101 Posts: 31Questions: 4Answers: 0

    there's really something wrong with my code

  • dnepomuceno101dnepomuceno101 Posts: 31Questions: 4Answers: 0



    im using this

  • dnepomuceno101dnepomuceno101 Posts: 31Questions: 4Answers: 0



    it hides my buttons :(

  • kthorngrenkthorngren Posts: 21,160Questions: 26Answers: 4,921

    See if this threda or this thread helps.

    Kevin

  • dnepomuceno101dnepomuceno101 Posts: 31Questions: 4Answers: 0

    i read all the discussion here nothing helps me :( , do i need to remove some words in the .JS folder

  • dnepomuceno101dnepomuceno101 Posts: 31Questions: 4Answers: 0

    $(".btn-primary").removeClass("btn-secondary");
    where do i put this code maybe it will help me

  • JuJoGuAlJuJoGuAl Posts: 32Questions: 2Answers: 0

    well, first Use just ONE COMMENT to add yours answers, second, put the CODE in Text mode not print pics (use http://live.datatables.net/ or http://jsfiddle.net/user/dashboard/) is better to see the data, now is u cant see the buttons means u dont have bootstrap class added or something (i will need the text code)

  • dnepomuceno101dnepomuceno101 Posts: 31Questions: 4Answers: 0

    sorry new here

  • kthorngrenkthorngren Posts: 21,160Questions: 26Answers: 4,921

    $(".btn-primary").removeClass("btn-secondary");
    where do i put this code maybe it will help me

    Try initComplete. IF you still need help then as JuJoGuAl mentions please provide a test case so we can more efficiently help you.

    Kevin

  • dnepomuceno101dnepomuceno101 Posts: 31Questions: 4Answers: 0

    thank you for replying sir's :)

This discussion has been closed.