Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/77.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
Cakephp 为什么属性是';可排序';消失在<;th>-由html助手生成的标记_Cakephp_Cakephp 3.0 - Fatal编程技术网

Cakephp 为什么属性是';可排序';消失在<;th>-由html助手生成的标记

Cakephp 为什么属性是';可排序';消失在<;th>-由html助手生成的标记,cakephp,cakephp-3.0,Cakephp,Cakephp 3.0,我将创建一个标题如下的表: <th field="id" formatter="" styler="" sortable="true">#Asset</th> 但是stangely,我得到的结果是: <th field="id" formatter="" styler="" sortable="sortable">#Asset</th> 结果更奇怪,属性“sortable”消失了: <th field="id" formatter=""

我将创建一个标题如下的表:

<th field="id" formatter="" styler="" sortable="true">#Asset</th>
但是stangely,我得到的结果是:

<th field="id" formatter="" styler="" sortable="sortable">#Asset</th>
结果更奇怪,属性“sortable”消失了:

<th field="id" formatter="" styler="">#Asset</th>
#资产

谢谢你帮助我。

sortable
is/was a。此类属性的
false
状态通过不定义属性来表示,其
true
状态通过空值或属性名称来表示。实际值
true
false
对于布尔属性无效

为了向后/跨浏览器兼容性,CakePHP使用后一个值变量。将
false
-ish值(例如空字符串)传递给HTML帮助器将导致不添加属性

ps.
sortable
是去年发布的,它不再出现在当前的HTML5.1推荐中

另见


好的,这让我明白了。由于此属性用于datagrid的jquery脚本中,因此是否有使用此属性的变通方法?不要使用HTML帮助程序,或使用从压缩属性列表中删除
sortable
的扩展模板程序(可通过helpers
templateClass
选项配置),或者修复jQuery脚本,使其正确处理布尔属性。
$this->Html->tag('th',#Asset,'field'=>'id', [
    'formatter'=>'',
    'styler'=>'',
    'sortable'=>''
]);
<th field="id" formatter="" styler="">#Asset</th>