jqury each的使用
2011年09月01日
" rel="stylesheet" type="text/css" media="screen" />
" rel="stylesheet" type="text/css" media="print" />
">
">
">
/widgets/tree/lis t/list.css" rel="stylesheet" type="text/css" />
/widgets/tree/list /list.js">
'>
var rootPath="";
/widgets/treeclass ify/jquery.js">
" rel="stylesheet" type="text/css" />
#mytable {
width: 100%;
padding: 0;
margin: 0;
}
th {
font: bold 11px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
color: #4f6b72;
border-right: 1px solid #C1DAD7;
border-bottom: 1px solid #C1DAD7;
border-top: 1px solid #C1DAD7;
letter-spacing: 2px;
text-transform: uppercase;
text-align: left;
padding: 6px 6px 6px 12px;
background: #CAE8EA no-repeat;
}
td {
border-right: 1px solid #C1DAD7;
border-bottom: 1px solid #C1DAD7;
background: #fff;
font-size:11px;
padding: 6px 6px 6px 12px;
color: #4f6b72;
}
var doctaskid=0;
var x = 0;
function submitMethod(doctaskid){
Ext.MessageBox.confirm('',"确定提交此任务吗?",
function(btn){
if(btn=="yes"){
Ext.Ajax.request({
method:"POST",
encoding:"UTF-8",
url:rootPath + "/project/pretask2Submit.do?iscommand=true&project .id="+doctaskid,
success:function(response,options){
var json = Ext.util.JSON.decode(response.responseText);
Ext.alert.msg('',json.returnMessage);
if(json.message=="成功提交任务!"){
//alert("ext " +doctaskid);
// var urlPath = rootPath + "/project/pretask2Submit.do?iscommand=true&project .id="+doctaskid;
//LayoutA.showContent2NewPanel('',urlPath, true,41, null);
}
},
failure:function(result,request){
Ext.alert.msg('', "任务提交失败",'error');
}
});
}
});
}
function pre2submit(){
$('#mytable tr').each(function(i,d){
var $tr = $(d);
var $td = $tr.children(':first-child');
var $input = $td.children('input');
alert($input.attr('checked') && x==0);
if($input.attr('checked')==null && x==0){
Ext.alert.msg('tip',"请选择一条数据",'warn');
return;
}
if ($input.attr('checked')) {
/*alert($tr.find(".displayname").text());
alert($tr.find(".uncpath").text());
alert($tr.find(".id").val());
alert($tr.find(".clipguid").val());
alert($tr.find(".resourcetype").val());
alert($tr.find(".parentid").val());*/
var doctaskid = $tr.find(".doctaskid").val();
x=1;
submitMethod(doctaskid);
}
});
}
选择
displayname
uncpath
${t.displayname }
${t.uncpath }
2011年09月01日
" rel="stylesheet" type="text/css" media="screen" />
" rel="stylesheet" type="text/css" media="print" />
">
">
">
/widgets/tree/lis t/list.css" rel="stylesheet" type="text/css" />
/widgets/tree/list /list.js">
'>
var rootPath="";
/widgets/treeclass ify/jquery.js">
" rel="stylesheet" type="text/css" />
#mytable {
width: 100%;
padding: 0;
margin: 0;
}
th {
font: bold 11px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
color: #4f6b72;
border-right: 1px solid #C1DAD7;
border-bottom: 1px solid #C1DAD7;
border-top: 1px solid #C1DAD7;
letter-spacing: 2px;
text-transform: uppercase;
text-align: left;
padding: 6px 6px 6px 12px;
background: #CAE8EA no-repeat;
}
td {
border-right: 1px solid #C1DAD7;
border-bottom: 1px solid #C1DAD7;
background: #fff;
font-size:11px;
padding: 6px 6px 6px 12px;
color: #4f6b72;
}
var doctaskid=0;
var x = 0;
function submitMethod(doctaskid){
Ext.MessageBox.confirm('',"确定提交此任务吗?",
function(btn){
if(btn=="yes"){
Ext.Ajax.request({
method:"POST",
encoding:"UTF-8",
url:rootPath + "/project/pretask2Submit.do?iscommand=true&project .id="+doctaskid,
success:function(response,options){
var json = Ext.util.JSON.decode(response.responseText);
Ext.alert.msg('',json.returnMessage);
if(json.message=="成功提交任务!"){
//alert("ext " +doctaskid);
// var urlPath = rootPath + "/project/pretask2Submit.do?iscommand=true&project .id="+doctaskid;
//LayoutA.showContent2NewPanel('',urlPath, true,41, null);
}
},
failure:function(result,request){
Ext.alert.msg('', "任务提交失败",'error');
}
});
}
});
}
function pre2submit(){
$('#mytable tr').each(function(i,d){
var $tr = $(d);
var $td = $tr.children(':first-child');
var $input = $td.children('input');
alert($input.attr('checked') && x==0);
if($input.attr('checked')==null && x==0){
Ext.alert.msg('tip',"请选择一条数据",'warn');
return;
}
if ($input.attr('checked')) {
/*alert($tr.find(".displayname").text());
alert($tr.find(".uncpath").text());
alert($tr.find(".id").val());
alert($tr.find(".clipguid").val());
alert($tr.find(".resourcetype").val());
alert($tr.find(".parentid").val());*/
var doctaskid = $tr.find(".doctaskid").val();
x=1;
submitMethod(doctaskid);
}
});
}
选择
displayname
uncpath
${t.displayname }
${t.uncpath }
本文介绍了一个使用 jQuery 的 each 方法来遍历表格元素并处理数据的示例。通过具体的应用场景展示了如何选择元素、检查条件及执行操作。
1万+

被折叠的 条评论
为什么被折叠?



