小编Jes*_*een的帖子

使用带有DataTables的列名和AJAX数据源

我正在尝试升级我的系统使用1.10而不是1.9的DataTables,我正在尝试找到一种方法来使用JSON对象而不是列表来传回行内容.具体而言,不是以[['data','data','data'],['data','data','data'],etc..]我希望将其格式化的格式传回数据[['colA':'data','colB':'data','colC':'data']].

现在我已经让我的AJAX函数以该格式返回数据,我正在尝试使用以下代码进行初始化:

$("table").DataTable({
    "columnDefs": [
        {"name": "wo_status", "title": "wo_status", "targets": 0},
        //repeat for each of my 20 or so fields
    ],
    "serverSide": true,
    "ajax": "url/to/ajax/function"
});
Run Code Online (Sandbox Code Playgroud)

结果正确地从我的AJAX函数返回,但是DataTables正试图在第0行中找到0的索引并且未能找到它,因为我的表格单元格被其列名而不是数字索引索引.有谁知道如何告诉DataTables使用columnDefs(或在其他一些我没有找到的选项)中指定的列名而不是数字索引?

javascript ajax jquery datatables

8
推荐指数
2
解决办法
1万
查看次数

如何使用 AWS SES 在电子邮件中发送附件

我正在尝试使用此处的代码使用亚马逊的 SES 库以编程方式发送电子邮件。调整后,我有以下代码段。

SESUtils.php

<?php

require_once('aws.phar');

use Aws\Ses\SesClient;

/**
 * SESUtils is a tool to make it easier to work with Amazon Simple Email Service
 * Features:
 * A client to prepare emails for use with sending attachments or not
 * 
 * There is no warranty - use this code at your own risk.  
 * @author sbossen 
 * http://right-handed-monkey.blogspot.com
 *
 * Update: Error checking and new params input array provided by Michael Deal
 */
class SESUtils {

const …
Run Code Online (Sandbox Code Playgroud)

php email email-attachments amazon-web-services

1
推荐指数
2
解决办法
8493
查看次数