简体   繁体   中英

JsGrid Custom Delete Confirmation Message

I am using jsGrid to show data. I want to replace the default delete confirmation message with that of "Alertify".

I tried to replace deleteConfirm:"Are you sure?" with a function below but it shows an empty alert box and When I click on OK or CANCEL, it shows custom "Alertify" box that I wanted to show.

  deleteConfirm: function(item){
  alertify.confirm("Do you want to delete this work experience?",
    function(){
      alertify.success('Ok');
    },
    function(){
      alertify.error('Cancel');
    });
 },

delete from database

 deleteItem: function(item){
   return $.ajax({
    url: "<?php echo base_url('admin/delWork');?>",
    data: item
   });
  },
 },

I want to show custom("Alertify") dialog box instead of default confirm dialog box.

You need to set confirmDeleting to false and use something like his in jsgrid configuration:

confirmDeleting: false,
onItemDeleting: function (args) {
    if (!args.item.deleteConfirmed) { // custom property for confirmation
        args.cancel = true; // cancel deleting
        confirm.showConfirm('Are you sure?', function() {
            args.item.deleteConfirmed = true;
            $grid.jsGrid('deleteItem', args.item); //call deleting once more in callback
        });
    }
},

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM