jquery jtable不执行listAction函数

时间:2014-09-30 13:50:36

标签: jquery jquery-jtable

我有以下代码(来自网站示例)

$('#reportsTableContainer').jtable({
    title: 'Table of people',
    actions: {
        listAction: function (postData, jtParams) {
            ret = {
                "Result": "OK",
                "Records": [{
                    "PersonId": 1,
                    "Name": "Benjamin Button",
                    "Age": 17,
                    "RecordDate": "\/Date(1320259705710)\/"
                }]
            }
            return ret;
        },
    },
    fields: {
        PersonId: {
            key: true,
            list: false
        },
        Name: {
            title: 'Author Name',
            width: '40%'
        },
        Age: {
            title: 'Age',
            width: '20%'
        },
        RecordDate: {
            title: 'Record date',
            width: '30%',
            type: 'date',
            create: false,
            edit: false
        }
    }
});
$('#reportsTableContainer').jtable('load');


}; // end initJTable

当我运行它时,我进入控制台 -

http://localhost/valuepro/valuepro/main/function%20(postData,%20jtParams)%20%7Bret%20=%20%7B%20%22Result%22:%22OK%22,%20%22Records%22:[%20%20%7B%22PersonId%22:1,%22Name%22:%22Benjamin%20Button%22,%22Age%22:17,%22RecordDate%22:%22//Date(1320259705710)//%22%7D,%20%20%7B%22PersonId%22:2,%22Name%22:%22Douglas%20Adams%22,%22Age%22:42,%22RecordDate%22:%22//Date(1320259705710)//%22%7D,%20%20%7B%22PersonId%22:3,%22Name%22:%22Isaac%20Asimov%22,%22Age%22:26,%22RecordDate%22:%22//Date(1320259705710)//%22%7D,%20%20%7B%22PersonId%22:4,%22Name%22:%22Thomas%20More%22,%22Age%22:65,%22RecordDate%22:%22//Date(1320259705710)//%22%7D%20]%7Dreturn%20ret;%7D

即。而不是执行该函数,它将其变为一个字符串,并尝试从SRV中获取它。

为什么?这段代码出了什么问题?

我应该如何从listAction执行函数而不是从SRV中获取数据?

1 个答案:

答案 0 :(得分:0)

升级到版本2.4.0解决了这个问题