开发者

jqgrid: I would like to auto select the cell my mouse is currently hovering over

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\开发者_如何学Python" 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


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);
    });
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜