How do I send data from my JQGrid to my query to delete a row?

前端 未结 2 954
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-25 07:06

I am unable to delete a row from my JQGrid because I can\'t figure out how to send the data I need to the file that holds the MySQL. I am using ColdFusion.

In my JQGrid

2条回答
  •  佛祖请我去吃肉
    2021-01-25 07:19

    Cannot really help much without seeing your code that comes back from your CFC to populate the grid. However, one approach is to access the id of the row and put it in some HTML element like an anchor tag, for example:

    If you are creating a loop to prepare your data

    //Some loop
    
    Delete" />
    

    Then you pass your JSON object to the CFM file

     
    

    Then in the page that displays the grid add an event that handles the click of the anchor tag

    $('a.delete').on('click', function(){
        var id = $(this).attr('id');
        //do something with the id
    })
    

    Hope that helps!

提交回复
热议问题