Reputation: 1391
I know this may be an odd question. How do I auto select the cell in jqgrid that my mouse is currently hovering over? The reason for this is, I am not exactly sure how to accomplish my custom deletion of a row without the cell being selected first.
Currently I have:
jqgrid code snippet:
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() {
//do code
});
},
Problem:
The function will NOT execute when I click the button without the cell selected. If I select the cell then click the button the deleteRow() function will execute.
Possible Solution?:
The idea is to auto select the cell my mouse is currenAtly hovering for when the user does click the button the function will execute properly. All other ideas are welcome :-)
EDIT
Working Code:
The idea of auto select the cell was rather simple with jQuery.
code:
$(this).mouseover(function() {
var valId = $(".ui-state-hover").attr("id");
jQuery("#breed_list").setSelection(valId, false);
//alert(valId);
});
-Rich
Upvotes: 0
Views: 1718
Reputation: 1391
Working Code:
The idea of auto select the cell was rather simple with jQuery.
code:
$(this).mouseover(function() {
var valId = $(".ui-state-hover").attr("id");
jQuery("#breed_list").setSelection(valId, false);
//alert(valId);
});
Upvotes: 1