Call a function from a button that is created during jqGrid's gridComplete event?

后端 未结 2 2011
谎友^
谎友^ 2021-01-07 10:55

I\'m trying to call a function in the onclick event of the button that is created during the gridComplete event..Loads OK…here\'s what the rendered html looks like for the b

2条回答
  •  孤城傲影
    2021-01-07 11:26

    I would change your grid complete function so that it gives the imput a class of say "delete" and then in my document ready function setup a live click event for that class selector.

    something like this

    gridComplete: function() {
        var ids = jQuery("#list").jqGrid('getDataIDs');
        for (var i = 0; i < ids.length; i++) {
            var cl = ids[i];
            de = '';
            $("#list").jqGrid('setRowData', ids[i], { Delete: de });
        }
    }
    
    $('#list .delete').live('click',function(){
        var id = $(this).parent().attr('id');
    });
    

提交回复
热议问题