开发者

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

开发者 https://www.devze.com 2023-03-02 00:09 出处:网络
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

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

精彩评论

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