|
现象: 页面中,不使用easyui标签, 而是自己引入jquery&easyui时, 在整个大框架中,会出现jquery根本不启动的情况(无法识别)
即: 浏览器里直接访问某个controller,是可以正常加载的,但如果是框架中的菜单事件,来加载controller返回的view,就会发现jQuery根本无法执行,见下图
附上页面的源码实现:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%-- <%@include file="/context/mytags.jsp"%> --%>
<%@ page buffer="20kb"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path;
System.out.println(basePath);
%>
<!DOCTYPE HTML>
<html>
<head>
<base herf="<%=basePath%>" />
<%-- <t:base type="jquery,easyui,tools,DatePicker"></t:base> --%>
<link rel="stylesheet" type="text/css" href="<%=basePath%>/easyui/themes/default/easyui.css" />
<link rel="stylesheet" type="text/css" href="<%=basePath%>/easyui/themes/icon.css" />
<script src="<%=basePath%>/easyui/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="<%=basePath%>/easyui/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="<%=basePath%>/easyui/easyloader.js"></script>
<script type="text/javascript" src="<%=basePath%>/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript">
easyloader.locale = "zh_CN";
var jq172 = jQuery.noConflict(true);
(function($) {
$(function() {
$('<div id="test">测试DIV</div>').appendTo("body");
$('#oms').datagrid({
width: 'auto',
height: 'auto',
stripped: true,
url: '<%=basePath%>/ommgMenuScheConfigController.do?searchMealName',
loadMsg: '正在加载数据',
showHeader: true,
rownumbers: false,
fitColumns: true,
columns: [[
{field:'mealNum',title:'餐次ID',hidden:false, width:100, align:'center'},
{field:'mealName',title:'餐次名称',width:400,align:'center'}
]],
onLoadSuccess: function(data){
alert('success');
},
onLoadError: function() {
alert('error');
},
onBeforeLoad: function(prm) {
alert('before load from remote.');
}
});
});
}) (jq172);
</script>
</head>
<body bgcolor="white" >
<div>
<span style="font-size:20px">
排班配置界面
</span>
</div>
<div >
<table id="oms" >
</table>
<!-- <table id="oms" class="easyui-datagrid" style="width:400px;height:250px"
data-options="url:'ommgMenuScheConfigController.do?searchMealName',fitColumns:true">
<thead>
<tr>
<th data-options="field:'mealNum',width:100, align:'center'">编码</th>
<th data-options="field:'mealName',width:100, align:'center'">餐次</th>
</tr>
</thead>
</table> -->
</body>
</html>
|
|