开发者

jquery datatables editable plugin - Delete Confirmation Dialog

I using editable plugin for my jquery datatable to do inline delete. Currently once the delete button is clicked, the controller delete action is called and the row will be deleted. However, i wish to show a confirmation dialog prior to deletion, and only if user click ok, the delete operation will proceed. I got no idea how to do this because the plugin just required the controller action url to be passed in the "sDeleteUrl" parameter. I cant get much information from the web too, hope can get some help here...... Really appreciate it (Following开发者_开发问答 is my code which initialize the datatable together with the editable plugin to enable inline delete)

    // Initialize data table
    var myTable = $('#stocktable').dataTable({

        // Try styling
        "sScrollX": "100%",
        "sScrollXInner": "100%",
        "bScrollCollapse": true,

        // To use themeroller theme
        "bJQueryUI": true,
        // To use TableTool plugin
        "sDom": 'T<"clear">lfrtip',
        // Allow single row to be selected
        "oTableTools": {
            "sRowSelect": "single"
        }
        // Use dataTable editable plugin to allow ajax delete
    }).makeEditable({
        // Reference to controller action
        //sAddURL: "/Stock/AddData",
        sDeleteURL: "/Stock/DeleteData",
        sDeleteHttpMethod: "GET",
        // Add "" for class for IE to works
        oDeleteRowButtonOptions: {
            label: "Remove",
            "class": "buttons"
        }
    });


See http://jquery-datatables-editable.googlecode.com/svn/trunk/custom-messages.html. In the on row deleting you can put confirmation message and call delete function if true is returned from the confirm box.

In this example is used jConfirm but you can use the plain confirmation dialog and call fnDeleteRow(id); if user clicks "Ok".

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜