自定义行颜色 Jquery Bootgrid

Custom row color Jquery Bootgrid

使用 jQuery Bootgrid,"default" 状态映射有效(成功、信息、警告、错误),但在我自定义它时,它不起作用。这个问题的解决方案不适用于我的情况:

下面是我对脚本的初始化。

$(document).ready(function(){
    $("#client_list").bootgrid({
        css: {
            icon: "zmdi icon",
            iconColumns: "zmdi-view-module",
            iconDown: "zmdi-sort-amount-desc",
            iconRefresh: "zmdi-refresh",
            iconUp: "zmdi-sort-amount-asc"
        },
        ajax: true,
        post: function(){
            return { id: "b0df282a-c9e93b7befee" };
        },
        url: "get_logview/client/client",
        caseSensitive: false,
        selection: false,
        multiSelect: true,
        rowSelect: true,
        searchSettings: {
            delay: 100,
            characters: 3
        },
        keepSelection: true,
        statusMappings: {
            4: "loglow",
            5: "logmediumlow",
            6: "logmedium",
            7: "logmediumhigh",
            8: "loghigh",
            9: "logcritical",
            10: "logcatastrophic"
        }
    });
});

我的数据确实包含正确的状态值,如下所示:

{
    "current": 1,
    "rowCount": "10",
    "rows": [
        {
            "id": "1",
            "type": "Notice",
            "message": "User 127.0.0.1 (User ID: 1) accessed the logs.",
            "impact": "Low",
            "user": "127.0.0.1 (User ID: 1)",
            "createdate": "2016-07-20 19:39:03",
            "status": 4
        },
        {
            "id": "2",
            "type": "Notice",
            "message": "User 127.0.0.1 (User ID: 1) accessed the logs.",
            "impact": "Low",
            "user": "127.0.0.1 (User ID: 1)",
            "createdate": "2016-07-20 19:39:03",
            "status": 4
        }
    ],
    "total": "2"
}

有人可以告诉我做错了什么吗?没有控制台错误,引导网格 table 显示,但不会显示自定义颜色。

发现问题:初始化必须是"statusMapping",而不是"statusMappings"。插件的文档不正确:http://www.jquery-bootgrid.com/documentation#statusmappings

将相应地在 Github 上提交错误报告。