小编Amy*_*Amy的帖子

数据表:根据值更改单元格颜色

我正在使用DataTable来创建交互式表.我有9列,其中5列是值.我想根据具体情况更改每个单元格的背景颜色.

我开始试图首先改变整行颜色,因为这似乎是一个更容易的任务.但是,我无法改变任何事情.

我的代码如下:

    <head>  
    <link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.13/css/jquery.dataTables.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
    <script type="text/javascript" charset="utf8" src="//cdn.datatables.net/1.10.13/js/jquery.dataTables.js"></script>      

    <script>
        $(document).ready(function(){
            $('#countryTable').DataTable();
        });
    </script>

    <script>
        $(document).ready( function () {
        $('#countryTable ').DataTable({
            "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
                if ( aData[3] > 11.7 )
                {
                    $(nRow).css('color', 'red')
                }
                else if ( aData[2] == "4" )
                {
                    $(nRow).css('color', 'green')
                }
            }
        });
    </script>

</head>

<body>      

    <table id ="countryTable" class="display" cellspacing="0" data-page-length='193'>
<thead>
    <tr>
        <th>Rank</th>
        <th>Country</th>
        <th>Code</th>
        <th>Total</th>
        <th>Beer</th>
        <th>Wine</th>
        <th>Spirits</th>
        <th>Other</th>
        <th>Score</th>
    </tr>
</thead>
<tbody> …
Run Code Online (Sandbox Code Playgroud)

datatables

16
推荐指数
1
解决办法
5万
查看次数

SQL Server 间隔和::

我想我正在处理 SQL Server 脚本中的一些代码,我只是想了解它的一些功能:

  1. 我的第一个问题:

(current_month - Interval '1 Month')::date as start_date,

这行代码是做什么的?是IntervalSQL 中内置的 word 吗?该部分是什么::date意思?

  1. 我的第二个问题非常相似:

select current_date::date as date

这是在做什么?

抱歉,如果这些是基本问题,我是新手,在网上找不到任何内容。

sql postgresql

1
推荐指数
1
解决办法
3614
查看次数

标签 统计

datatables ×1

postgresql ×1

sql ×1