我想跳過表中的2個不同類別的2 tr。JQuery tr:不要跳過2個類名稱的trs
first class with class is .gridTitleRow and 2nd tr with class is .gridSpan。如何在下面的語法中跳過這些內容?
$.each($(".gridTable tr:not(.gridTitleRow)"), function(a, b){});
EDITED我使用每個像下面
$("#gridBtn").live("click", function (e) {
e.preventDefault();
var indexArraay = [];
var flag = false;
$.each($(".gridTable tr:not(.gridTitleRow)"), function(a, b){
var id = $("input.idField", b).val();
var order = $("input[id='index']", b).val();
var active = $("input[id='activeCb']", b).attr("checked");
var deleteRow = $("input[id='deleteCb']", b).attr("checked");
(deleteRow == true) ? flag = true : null;
indexArraay.push({
"id": id,
"index": order,
"active": active,
"delete": deleteRow
})
});
if (flag == true)
{
$("#dialog:ui-dialog").dialog("destroy");
var text = "Alert: Deleting footer Prent menu will delete all submenus and assigned pages to it.";
$('<div title="Confirmation:">' + text + '</div>').dialog({
height: 'auto',
width: 350,
modal: true,
resizable: false,
buttons: {
Cancel: function() {
$(this).dialog("close");
},
Confirm: function() {
$(this).dialog("close");
ProcessGrid(indexArraay);
ReloadGrid();
}
}
});
}else{
ProcessGrid(indexArraay);
//ReloadGrid();
}
}); //End of gridBtn
表
<script id="gridTemplate" type="text/x-jQuery-tmpl">
<tr class="gridRow">
<td class="gridSpan" colspan="5">${$data[0].Title}</td>
</tr>
{{tmpl($data) "#cellTemplate"}}
</script>
<script id="cellTemplate" type="text/x-jQuery-tmpl">
<tr class="gridRow">
<td class="cellTd ">
<input type="checkbox" id="deleteCb" />
<input type="hidden" id="Id_ + ${num}" class="idField" value="${Id}" />
</td>
<td class="cellTd">
<input id="index" name="index" class="numberField" type="text" value="${IndexOrder}" />
</td>
<td class="cellTd">${DisplayName}</td>
<td class="cellTd ">${UrlName}</td>
<td class="cellTd ">
<input type="checkbox" id="activeCb" {{if Active}} checked{{/if}} />
</td>
</tr>
</script>
<span class="instructions">Only numeric value is allowed in IndexOrder textbox.</span>
<div class="gridDiv">
<table class="gridTable" cellspacing="0" cellpadding="0">
<tbody>
<tr class="gridTitleRow">
<td class="iconLink width36">Delete</td>
<td class="iconLink width60">Sort Order</td>
<td class="iconLink widthAuto">Display Name</td>
<td class="iconLink widthAuto">Url Name</td>
<td class="iconLink widthAuto">Active</td>
</tr>
</tbody>
</table>
你不能簡單地添加'not(.gridTitleRow,.gridSpan)'? – 2011-06-13 20:11:16
@pendo,那不工作 – Pirzada 2011-06-13 21:05:02
我更新了我的答案。 – Pointy 2011-06-13 21:26:02