您当前的位置: 首页 > 

漏刻有时

暂无认证

  • 0浏览

    0关注

    717博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

datatable 自定义筛选按钮的解决方案

漏刻有时 发布时间:2022-03-02 15:03:38 ,浏览量:0

在这里插入图片描述

HTML按钮


    正常
    警告
    停机

JS操事件
    $(function () {
        $('#progress').on('click', function () {
            $('.dataTables_filter [type=search]').val("正常运行").keyup();
        });

        $('#alerted').on('click', function () {
            $('.dataTables_filter [type=search]').val("警告").keyup();
        });

        $('#closed').on('click', function () {
            $('.dataTables_filter [type=search]').val("停机").keyup();
        });
    })
JS配置项
  dom: 'tip',//控件位置
                bFilter: true,//过滤
                pagingType: "first_last_numbers",//分页样式
                pageLength: 10,//默认显示条数;
                bPaginate: true,//分页总开关
CSS样式
/*弹出模态框筛选组*/
.btn-group {
    margin-top: 10px;
    float: left;
    margin-left: 10px;
    display: inline-block;
}

#progress {
    width: 80px;
    height: 30px;
    color: #fff;
    outline: none;
    border: 0;
    border-radius: 5px;
    background: #01a016;
    cursor: pointer;
}

#alerted {
    width: 80px;
    height: 30px;
    color: #fff;
    outline: none;
    border: 0;
    border-radius: 5px;
    background: #e60000;
    cursor: pointer;
}

#closed {
    width: 80px;
    height: 30px;
    color: #fff;
    outline: none;
    border: 0;
    border-radius: 5px;
    background: rgba(173, 148, 1, 1);
    cursor: pointer;
}

.searchBox {
    float: right;
    display: inline-block;
    margin-top: -25px;
    margin-right: 10px;
}

.searchBox select {
    width: 60px;
    height: 26px;
}

.searchBox input {
    width: 100px;
    height: 26px;
}

#example_filter {
    margin-left: 20px;
}

@lockdata.cn

关注
打赏
1661217259
查看更多评论
立即登录/注册

微信扫码登录

0.1191s