how to draw borders on all table cells?

how to draw borders on all table cells?

izumovizumov Posts: 178Questions: 14Answers: 0

is it possible to do this when the table is initialized, or can this be done only with the help of the css? Tell me an example code.

Replies

  • kthorngrenkthorngren Posts: 20,143Questions: 26Answers: 4,736

    If you are not using a styling framework then the [Styling doc}(https://datatables.net/manual/styling/classes) shows the Datatables styles you can apply to the table, for example, cell-border. If you are using a styling framework, like Bootstrap, then you would apply the style it uses.

    Kevin

  • izumovizumov Posts: 178Questions: 14Answers: 0

    to create a table I wrote code

    $('#orders').DataTable( {
             "order": [[ 0, "desc" ]],
             sDom: 'lrtip',
             select: true,
             scrollY: true,
             scrollX:true,
             columnDefs:[
             {
             target:1,
             className:'cell-border'
             }
             ],
             "sRowSelect": "single",
            "processing": true,
            "bPaginate": true,
            "bSort": true,
            "serverSide": true,
            "autoWidth":true,
            // "ajax": "proc.php"
            "ajax": {
            url:"server_processingorders.php",
            data:function(d){d.kod=findGetParameter('id');
            d.startdate=StartDate;
            d.enddate=EndDate;}
            }
    
        
    
        } )
    

    but the cell border did not appear. What's my mistake?

  • kthorngrenkthorngren Posts: 20,143Questions: 26Answers: 4,736

    The class is to be placed on your table tag, for example:
    http://live.datatables.net/yihesusa/1/edit

    Kevin

  • izumovizumov Posts: 178Questions: 14Answers: 0

    is it possible to change the color of the border of the grid of the table? is it possible to flexibly customize the fonts of the table? by analogy with the adjustment of alignment? in the stylization guide I did not find answers to these questions. Tell me.

  • colincolin Posts: 15,112Questions: 1Answers: 2,583

    Here's the styling page here - it's all done through CSS so just requires adding/removing classes.

    Colin

  • izumovizumov Posts: 178Questions: 14Answers: 0

    Generated the CSS style and everything seems to be fine, but the cell border in the last right column is not visible. What is the problem?
    I give a table view in the attached file

  • izumovizumov Posts: 178Questions: 14Answers: 0

    I mean the right border of the cell

  • izumovizumov Posts: 178Questions: 14Answers: 0
    edited February 2020

    and what is remarkable there are borders on "th", and on there is no border on" body td"

  • colincolin Posts: 15,112Questions: 1Answers: 2,583

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • izumovizumov Posts: 178Questions: 14Answers: 0
  • izumovizumov Posts: 178Questions: 14Answers: 0

    I’m still worried about the dualism of the border in the th I do not understand how to remove it

  • izumovizumov Posts: 178Questions: 14Answers: 0

    the table cells in the first and last columns have one gray border, but I need all to be black. How to achieve this in my example?

This discussion has been closed.