0
的jqGrid片段:jqgrid:爲什麼我會接受「eData」而不是id屬性值?
gridComplete: function(){
var ids = jQuery("#breed_list").jqGrid('getDataIDs');
for(var i=0;i < ids.length;i++)
{
var cl = ids[i];
ed = "<img src="../images/edit.png" alt="Edit" onclick="jQuery('#breed_list').editRow('"+cl+"');" />";
de = "<img class="del_row" src="../images/delete.png" alt="Delete" />";
ce = "<input class="del_row" type='button' onclick="deleteRow()" />";
jQuery("#breed_list").jqGrid('setRowData',ids[i],{act:ed+de+ce});
}
$(this).mouseover(function() {
var valId = $('.ui-state-hover').attr("id");
jQuery("#breed_list").setSelection(valId, false);
alert(valId);
//deleteRow(valId)
});
自定義功能的代碼:
function deleteRow(){
// Get the currently selected row
var toDelete = $("#breed_list").jqGrid('getGridParam','selrow');
// You'll get a pop-up confirmation dialog, and if you say yes,
// it will call "delete.php" on your server.
$("#breed_list").jqGrid(
'delGridRow',
toDelete,
{
url: 'delete.php',
reloadAfterSubmit:false
}
);
//alert(toDelete);
}
即碼自正確地選擇所述懸停的細胞不被執行時delGridRow。當我點擊actions列下的按鈕時,它會調用執行delGridRow的deleteRow()函數。當我點擊取消刪除表單關閉。現在,當我懸停單元格時,它不會自動選擇當前懸停的單元格。爲了調試這個,我把alert(valId)放在.mouseover函數中,它返回eData而不是id屬性值。只要不執行deleteRow函數,alert(valId)就會發出id屬性值。爲什麼eData應該在返回id屬性值時設置爲valId?我如何解決這個問題?
編輯
顯然,我一直要對這個硬盤的方式。我回到了基本網格和gridComplete。
jqGrid的片段:
de = "<input style='height:22px;width:20px;' type='button' value='d' onclick=\"deleteRow('"+cl+"');\" />";
deleteRow功能代碼:
function deleteRow(valId){
jQuery("#breed_list").setSelection(valId, false);
// You'll get a pop-up confirmation dialog, and if you say yes,
// it will call "delete.php" on your server.
$("#breed_list").jqGrid(
'delGridRow',
valId,
{
url: 'delete.php',
reloadAfterSubmit:false
}
);
//alert(toDelete);
}
就像一個魅力了,但我還是想納入mousehover功能如前所述。
你是什麼意思? – dottedquad 2011-04-29 21:17:41
轉到人們提交的所有問題的答案,然後單擊複選標記以接受答案 – slandau 2011-04-29 21:33:42
你知道,我一直想提高其他人的信譽,但不知道如何實現這一點。現在我做:-) – dottedquad 2011-04-29 21:39:17