[英]Struts2 jQuery Conflict - jquery dataTables and the Struts2 Jquery Plugin
我目前面臨與Datatables和Struts2 Jquery插件一起使用時的兼容性問題。 struts2 jquery插件的唯一初始化(即)使我的數據表不再起作用。 當我刪除數據表workfine,但是我需要使用Struts2 Jquery插件進行顯示和使用datepicker時
我在我的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>
我需要在項目中使用它們,或者如果它們是提交日期選擇器的另一種方法,則需要使用它們
我通過使用這個解決了這個沖突
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
<html>
<head>
<sx:head />
</head>
代替
<%@taglib uri="/struts-jquery-tags" prefix="sx" %><
<html>
<head>
<sx:head jquerytheme="flick" />
</head>
並像這樣使用datapicker:
<sx:datetimepicker name="name" label="date" displayFormat="dd/mm/yy" value="today" />
enter code here
解決方案2
現在一切正常,我正在將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
......
});
},
});
代替
$(document).ready(function() {
dt_b: function() {
$j('#dt_b').dataTable({
"sScrollX": "100%",
"sScrollXInner": '110%',
"sPaginationType": "bootstrap",
"bScrollCollapse": true
......
});
},
});
謝謝
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.