使用GLYPH图标作为复选框(图标检查和图标检查为空),如何获得检查的行总数
Using GLYPH Icons as check boxes (icon-check and icon-check-empty), how to get total checked rows
基于我为行中的第一列使用图标集的事实,默认值是(图标检查为空),如下所示:
<i id="dataCbx{{id}}" style="text-align:center;" class="icon-check-empty center pointerCursor"
title="Click here to check/uncheck the box.
This will indicate you want to CLEAR this alert from the list.
Click on another part of the row to expand collapse without affecting
the checkbox" onclick="changeIcon(this.id); checkAlerts(this.id);">
</i>
所以用户检查一个ROW,我对此很满意。。。但是,当/如果用户随机选择多行时,我将如何捕捉?
因此,基本上,我将使用PUT通过web服务发送ID,并将已确认的标志更改为TRUE或FALSE。
以下是当用户选中SINGLE框(COL0)时工作的代码的平衡。此复选框不是INPUT字段。。。而是GLYPH标志。
function sortFilterClear(what) {
var listOfIDs = new Array();
if (what === "sort")
{
//Sorting on attribute
$('#alertTable > tr > td').tsort({attr: 'data-alert-level'});
} else {
//First check to see if the "SELECT ALL" CBX is checked...
if ($("#cbxMaster").hasClass("icon-check"))
{
bootbox.confirm("You are about to clear all alerts'n'n'
Are you sure this is what you want to do?'n'n'
Click OK to Clear or CANCEL to do nothing.", function(result) {
//This is for the RESULT tab to pop out from the RIGHT OPTIONAL
//Example.show("Confirm result: " + result);
if(result)
{
//Send to command - CLEAR EVERYTHING!!!!!!!!!!!!
_clearCheckedRows(myAlertURL,'all');
}
});
} else if (currID.length > 0){
bootbox.confirm("You are about to clear a single alert with ID number: " + currID
+ "<br>Are you sure this is what you want to do?<br>"
+ "Click OK to Clear or CANCEL to do nothing.", function(result) {
//This is for the RESULT tab to pop out from the RIGHT OPTIONAL
//Example.show("Confirm result: " + result);
//NOW check if the user has said CANCEL!!!!!!!!
if(!result)
{
//IF SO, then CLEAR that SPECIFIC CHECKBOX and then STOP
changeIcon(currID);
//CLEAR CURRENT ID
currID="";
} else {
//HERE's where we actual DUMP the a single row.
_clearCheckedRows(myAlertURL,currID);
//HERE's where I'll check for MULTIPLE ROWS SELECTED
// SOME CODE GOES HERE
}
});
}
}
}
谢谢,
Peter
您可以获得图标检查元素的列表,这就是您的复选框:
var listOfIds = [];
$('.icon-check').each(function() {
listOfIds[listOfIds.length] = $(this).id;
});
alert(listOfIds);
但使用普通复选框(带隐藏类)并通过JavaScript 设置状态是一种很好的做法
相关文章:
- 为什么不't Javascript对我的输入值进行了一些重新检查
- Javascript更改图标
- 在单击任何位置时隐藏元素,而不检查每次DOM单击
- 如何检查管道中未定义的项目
- 主干-不管怎样,检查事件以前是否绑定过
- 使用javascript检查多个输入值,并在1次检查中标记多个输入框
- 递归使用 eval() 是检查程序执行的好方法吗?
- 检查onsubmit doenst work jquery contactform上的函数
- 单击更改图标并通过javascript添加一个css类
- JavaScript 检查隐藏字段中的值并将其设置为隐藏字段值
- API密钥使用和检查示例
- 如何让程序检查所选单词中是否有按键
- JS:检查URL中的参数,然后迭代一个参数为var的函数
- 用于检查数组中是否存在元素的javascript自定义方法
- 如何检查字符串的一部分与数组匹配
- Jquery如何检查今天的时间大于使用给定时间
- 使用GLYPH图标作为复选框(图标检查和图标检查为空),如何获得检查的行总数
- Angularjs-检查我是否输入并切换加载程序图标
- 检查煎茶中的项目图标
- 检查成功图标显示后做一些事情