Jquery jqgrid:我为什么要复仇;eData“;而不是id属性值?
jqgrid代码段:Jquery jqgrid:我为什么要复仇;eData“;而不是id属性值?,jquery,attributes,jqgrid,Jquery,Attributes,Jqgrid,jqgrid代码段: 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_li
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)
});
当delGridRow未执行时,该代码会自动正确选择悬停的单元格。当我单击actions列下的按钮时,它调用deleteRow()函数,该函数执行delGridRow。单击“取消”时,删除表单关闭。现在,当我将单元格悬停时,它不会自动选择当前悬停的单元格。为了调试这个,我在.mouseover函数中放置了alert(valId),该函数返回eData而不是id属性值。警报(有效)只要未执行deleteRow函数,就会发出id属性值警报。当eData应该返回id属性值时,为什么将其设置为有效?如何解决此问题
编辑显然,我一直在艰难地处理这件事。我回到了基本网格和gridComplete jQgrid代码段:
de = "<input style='height:22px;width:20px;' type='button' value='d' onclick=\"deleteRow('"+cl+"');\" />";
de = "<input style='height:22px;width:20px;' type='button' value='d' onclick=\"deleteRow('"+cl+"');\" />";
deleteRow function code:
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);
}
它现在很有魅力,但我还是想像前面解释的那样加入鼠标套功能。显然我一直在努力实现这一点。我回到了基本网格和gridComplete jQgrid代码段:
de = "<input style='height:22px;width:20px;' type='button' value='d' onclick=\"deleteRow('"+cl+"');\" />";
de = "<input style='height:22px;width:20px;' type='button' value='d' onclick=\"deleteRow('"+cl+"');\" />";
deleteRow function code:
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);
}
de=”“;
deleteRow函数代码:
函数deleteRow(有效){
jQuery(“品种列表”).setSelection(有效、错误);
//你会看到一个弹出的确认对话框,如果你说是,
//它将在您的服务器上调用“delete.php”。
$(“#品种列表”).jqGrid(
“delGridRow”,
有效,
{
url:'delete.php',
重新加载后提交:false
}
);
//警报(toDelete);
}
现在它很有魅力,但我仍然希望像前面解释的那样加入鼠标悬停功能。转到人们为您的所有问题提交的答案,然后单击复选标记接受答案。您知道,我一直想提高他人的可信度,但不知道如何做到这一点。现在我知道了:-)