bootstrap-table.js how to remove row within actionevent -


how change 'alert' click event in fiddle remove row in icon clicked? have tried several approaches none of have worked. want delete/remove row, not post alert. thank in advance.

here fiddle

        function actionformatter(value, row, index) {         return [     '<a class="like" href="javascript:void(0)" title="like">',     '<i class="glyphicon glyphicon-heart"></i>',     '</a>',     '<a class="edit ml10" href="javascript:void(0)" title="edit">',     '<i class="glyphicon glyphicon-edit"></i>',     '</a>',     '<a class="remove ml10" href="javascript:void(0)" title="remove">',     '<i class="glyphicon glyphicon-remove"></i>',     '</a>'        ].join('');           }     window.actionevents = {      'click .like': function (e, value, row, index) {     alert('you click icon, row: ' + json.stringify(row));     console.log(value, row, index); }, 'click .edit': function (e, value, row, index) {     alert('you click edit icon, row: ' + json.stringify(row));     console.log(value, row, index); }, 'click .remove': function (e, value, row, index) {     alert('you click remove icon, row: ' + json.stringify(row));     console.log(value, row, index);      }       }; 

added: var $table = $('#table')

and click function: 'click .remove': function (e, value, row, index) { $table.bootstraptable('remove', { field: 'id', values: [row.id] });

now works.

      var   $table = $('#table')   function actionformatter(value, row, index) {     return [ '<a class="like" href="javascript:void(0)" title="like">', '<i class="glyphicon glyphicon-heart"></i>', '</a>', '<a class="edit ml10" href="javascript:void(0)" title="edit">', '<i class="glyphicon glyphicon-edit"></i>', '</a>', '<a class="remove ml10" href="javascript:void(0)" title="remove">', '<i class="glyphicon glyphicon-remove"></i>', '</a>'    ].join('');       }     window.actionevents = {      'click .like': function (e, value, row, index) {     alert('you click icon, row: ' + json.stringify(row));     console.log(value, row, index); }, 'click .edit': function (e, value, row, index) {     alert('you click edit icon, row: ' + json.stringify(row));     console.log(value, row, index); },     'click .remove': function (e, value, row, index) {                $table.bootstraptable('remove', {                 field: 'id',                 values: [row.id]             });     } }; 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -