[英]Datatables FixedHeader plugin in Clojurescript
I am starting using ClojureScript, and I want to implement jQuery Datatable plugin on my site. 我开始使用ClojureScript,并且想在我的网站上实现jQuery Datatable插件。
So far I am able to add the datatable working: 到目前为止,我能够添加工作的数据表:
(:use [jayq.core :only [$]])
(if (false? (.isDataTable js/$.fn.dataTable "#report-table"))
(def reportDatatable (.dataTable (js/$ "#report-table") (clj->js {"bProcessing" false "paging" false "searching" false "ordering" false}) ))
)
The problem comes when I want to implement the FixedHeader plugin. 当我要实现FixedHeader插件时,问题就来了。 In http://www.datatables.net/extensions/fixedheader/
在http://www.datatables.net/extensions/fixedheader/
The Javascript version of initializing this plugins is: 初始化此插件的Javascript版本为:
$(document).ready( function () {
var table = $('#example').DataTable();
new $.fn.dataTable.FixedHeader( table );
} );
For some reason is not working for me the following code: 由于某些原因,以下代码对我不起作用:
(.FixedHeader js/$.fn.dataTable "#report-table")
The error that I am getting is TypeError: Cannot set property '_oPluginFixedHeader' of undefined. 我得到的错误是TypeError:无法设置未定义的属性'_oPluginFixedHeader'。 I know that it is a javascript - clojurescript translation issue because If I use the console and manually execute above Javascript code it is working.
我知道这是一个javascript-clojurescript翻译问题,因为如果我使用控制台并手动执行上述Javascript代码,则它可以正常工作。
Any suggestions? 有什么建议么?
So the working solution for me is: 所以对我来说可行的解决方案是:
(new js/$.fn.dataTable.FixedHeader "#report-table" (clj->js {"top" true }))
If someone suggests a more idiomatic way of calling a Datatable plugin, please go ahead. 如果有人建议使用一种更惯用的方式来调用Datatable插件,请继续。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.