[英]Struts2 jQuery Conflict - jquery dataTables and the Struts2 Jquery Plugin
I currently facing a problem of comptatibility working both with Datatables and the Struts2 Jquery Plugin. 我目前面临与Datatables和Struts2 Jquery插件一起使用时的兼容性问题。 The only initialization of the struts2 jquery plugin (ie. ) makes my datatables not working anymore.
struts2 jquery插件的唯一初始化(即)使我的数据表不再起作用。 when i remove my datatable workfine , but i need to use Struts2 Jquery Plugin for display and working with datepicker
当我删除数据表workfine,但是我需要使用Struts2 Jquery插件进行显示和使用datepicker时
I'm using this in my jsp file : 我在我的jsp文件中使用它:
<%@taglib uri="/struts-jquery-tags" prefix="sx" %>
<head> <sx:head jquerytheme="flick" />
and this :
<script src="Ressource/lib/datatables/jquery.dataTables.min.js"></script>
<script src="Ressource/lib/datatables/jquery.dataTables.sorting.js"></script>
I need to use both in my project or if they are another way to submit datepicker 我需要在项目中使用它们,或者如果它们是提交日期选择器的另一种方法,则需要使用它们
i was solve this conflict by using this 我通过使用这个解决了这个冲突
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
<html>
<head>
<sx:head />
</head>
instead of 代替
<%@taglib uri="/struts-jquery-tags" prefix="sx" %><
<html>
<head>
<sx:head jquerytheme="flick" />
</head>
and use datapicker like that : 并像这样使用datapicker:
<sx:datetimepicker name="name" label="date" displayFormat="dd/mm/yy" value="today" />
enter code here
solution 2 解决方案2
Now all work fine i'm using struts2-jquery-plugin-3.7.1.jar
with jquery-min.js 1.7.2
, the$() syntax is always used by other scripting library, and causing the conflict issue and fail to call the jQuery function.Now i use this 现在一切正常,我正在将
struts2-jquery-plugin-3.7.1.jar
与jquery-min.js 1.7.2
,$()语法始终由其他脚本库使用,并导致冲突问题,并且无法调用jQuery function.Now我使用这个
$j=jQuery.noConflict();
$j(document).ready(function() {
dt_b: function() {
$j('#dt_b').dataTable({
"sScrollX": "100%",
"sScrollXInner": '110%',
"sPaginationType": "bootstrap",
"bScrollCollapse": true
......
});
},
});
Instead of 代替
$(document).ready(function() {
dt_b: function() {
$j('#dt_b').dataTable({
"sScrollX": "100%",
"sScrollXInner": '110%',
"sPaginationType": "bootstrap",
"bScrollCollapse": true
......
});
},
});
Thank you 谢谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.