Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 数据表1.10:类型=';类型';在渲染函数中_Jquery_Datatables - Fatal编程技术网

Jquery 数据表1.10:类型=';类型';在渲染函数中

Jquery 数据表1.10:类型=';类型';在渲染函数中,jquery,datatables,Jquery,Datatables,根据,当columns.render参数是函数时,它有四个参数,其中一个是“type”: 请求的类型调用数据-这将是“筛选”、“显示”, “类型”或“排序” 我理解每个选项,除了类型为“type”。我找不到有关类型参数何时或为什么为“type”的任何信息 有人知道type='type'的时间或原因吗?它有什么用?我猜这是文档中的一个错误/打字错误。上述段落定义了三种类型: 函数呈现(数据、类型、行、元) 说明: 如果给定一个函数,它将在DataTables需要时执行 获取列中单元格的数据。请注意

根据,当columns.render参数是函数时,它有四个参数,其中一个是“type”:

请求的类型调用数据-这将是“筛选”、“显示”, “类型”或“排序”

我理解每个选项,除了类型为“type”。我找不到有关类型参数何时或为什么为“type”的任何信息


有人知道type='type'的时间或原因吗?它有什么用?

我猜这是文档中的一个错误/打字错误。上述段落定义了三种类型:

函数呈现(数据、类型、行、元)

说明:

如果给定一个函数,它将在DataTables需要时执行 获取列中单元格的数据。请注意,此函数 可能被多次调用,因为DataTables将为 它需要不同的数据类型-排序、筛选和显示

根据,type=“type”是“类型检测数据”——用于自动检测故障的数据


我不认为在type=“type”时提供不同的数据通常是有用的。

我就是这么想的,但在渲染函数中包含一个控制台。log(type)显示“type”实际上被传递给函数。奇怪…有趣。我会在Datatables论坛上发表一篇帖子,直接询问开发者。他们通常都很乐于回应。谢谢!终于点击了!你的回答,以及(我发现多亏了你的回答)真的很有帮助。是的,我们可能会遇到一个“类型”这个词的例子;)
/*{
    "name":       "Tiger Nixon",
    "position":   "System Architect",
    "start_date": "1303682400",
    "office":     "Edinburgh"
}*/

{
    data: 'start_date',
    render: function ( data, type, row ) {
        // If display or filter data is requested, format the date
        if ( type === 'display' || type === 'filter' ) {
            var d = new Date( data * 1000 );
            return d.getDate() +'-'+ (d.getMonth()+1) +'-'+ d.getFullYear();
        }

        // Otherwise the data type requested (`type`) is type detection or
        // sorting data, for which we want to use the integer, so just return
        // that, unaltered
        return data;
    }
}