1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| var MasterTable; MasterTable = $('#tableID').DataTable( { "processing": true, "paging": true, "searching": true, "bFilter": false, "bDestroy": true, "scrollY": "455px", "scrollCollapse": true, "ajax": { "url": 'apiurl', "type": "POST", "dataType": "json", "data": { "MessgeType": "", "IsTop": "", "IsEnable": "" } }, "columns": [ { "data": null, "title": "功能", "sWidth": "60px", "className": "myCenter" }, { "data": "MessageNo", "title": "No", "sWidth": "50px", "className": "myCenter" }, { "data": "MessgeType", "title": "訊息類型", "sWidth": "100px", "className": "myCenter" }, { "data": "MessageTitle", "title": "訊息標題", "sWidth": "420px", "className": "myLeft" }, { "data": "IsTop", "title": "TOP", "sWidth": "70px", "className": "myCenter" }, { "data": "ExecuteStartDate", "title": "訊息啟用日期", "sWidth": "100px", "className": "myCenter" }, { "data": "ExecuteEndDate", "title": "訊息結束日期", "sWidth": "100px", "className": "myCenter" }, { "data": "IsEnable", "title": "啟用", "sWidth": "70px", "className": "myCenter" }, { "data": "FileID", "title": "檔案", "sWidth": "70px", "className": "myCenter" } ], columnDefs: [ { targets: 0, render: function (data,display,object,position) { return '<button type=\'button\' class=\'btn btn-info btn-sm\' data-toggle=\'modal\' data-target=\'#exampleModal\' onclick="DataContent(\'' + object.MessageNo + '\')" >設定</button>'; } }, { targets: 8, render: function (data, display, object, position) { if (object.FileID == '') return '<div> <div>'; else return '<button type=\'button\' class=\'btn btn-info btn-sm\' onclick="Download(\'' + object.FileID + '\', \'' + object.FileName + '\')" >' + object.FileName + '</button>'; } }], order: [[1, "desc"]] });
|