0

另一个问题已经被问到了,jQuery Datatables: how to delete the row,但我正在努力让语法正确。

我应该做什么而不是创建如下按钮?

    var otable = $('#tradeList').dataTable({
        "bServerSide": true,
        "sAjaxSource": serverDataSource,
        "bProcessing": true,
        "bLengthChange": false,
        "iDisplayLength": "15",

        "bPaginate": true,
        "sPaginationType": "full_numbers",
        "aoColumns": [
                     {
                         "sName": "ID",
                         "bSearchable": false,
                         "bSortable": false,
                         "bVisible": false
                     },
                     { "sName": "TRADENAME" },
                    {
                        "sName": "TRADEID",
                        "bSearchable": false,
                        "bSortable": false,
                        "fnRender": function (oObj) {
                            // oObj.aData[2] returns the TradeId
                            if (oObj.aData[2] == "0")
                                //return "<a href='" + deleteUrl + "?id=" + oObj.aData[2] + "'>Delete</a>";
                                return "<button onclick=" + dataService.deleteTrade(oObj.aData[2], fnDraw, deleteUrl ) + ")>";
                            else
                                return "";
                        }
                    }
            ]
        }).makeEditable({
        sUpdateURL: updateUrl,
        sAddURL: addUrl,
        sDeleteURL: deleteUrl
    });
4

0 回答 0