当前位置: 代码迷 >> Web前端 >> easyui layout使用有关问题
  详细解决方案

easyui layout使用有关问题

热度:441   发布时间:2013-08-01 15:23:18.0
easyui layout使用问题

easyui layout使用问题

在做一个easyui layout的demo的时候,遇到一个问题,就是不断该表窗口大小的时候有时候会报错:无效的参数

定位了一下,发现是jquery-1.8.0.js中有这么一行报错:

?

??????? f[b] = d;

f[b]接收的应该是 数字? +? px,但是d是NaN?? + ?px,这样就报错了

?

?

这个d是从最开始的jquery文件function (A, w)中的w赋值过来的,打个debugger端点发现这个w就是个undefined,搞不懂了,是浏览器问题?

暂时加了一个判断应付了事,但是有人遇到过这样的问题么?解决方案呢?:

if(d==='NaNpx'){
??????
?????//do nothing??
?????? }else {
??????? f[b] = d;
?????? }

?下面是这个demo的界面:

<%@ page language="java" contentType="text/html; charset=GBK"
??? pageEncoding="GBK"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
?<c:set value="${pageContext.request.contextPath}" var="path" scope="page"/>
?<link rel="stylesheet" type="text/css" href="${path}/js/com/nari/component/easyui/themes/default/easyui.css">?
?<link rel="stylesheet" type="text/css" href="${path}/js/com/nari/component/easyui/themes/icon.css">?
?<link rel="stylesheet" type="text/css" href="${path}/js/com/nari/component/easyui/demo.css">?
?<script type="text/javascript" src="${path}/js/com/nari/component/easyui/jquery.min.js"></script>?
?<script type="text/javascript" src="${path}/js/com/nari/component/easyui/jquery.easyui.min.js"></script>?
?<script type="text/javascript" src="${path}/js/com/nari/component/easyui/locale/easyui-lang-zh_CN.js"></script>?
?<meta http-equiv="Content-Type" content="text/html; charset=GBK">
?<title>tbUser初始化查询页面</title>
???? <style type="text/css">
??body {
???margin:0px;
???padding:0px;
???width:100%;
???height:100%;
??}
?</style>
?<script>
??var settime = null;
??function redraw(){
???$('#wrap').layout('resize');?
???$('#subWrap').layout('panel', 'north').panel('resize',{width:$('#subWrap').width()});
???$('#subWrap').layout('panel', 'center').panel('resize',{width:$('#subWrap').width()});
???$('#subWrap').layout('resize');
??}
??$(function(){??
???$(window).resize(function(){
????if(settime != null)
?????clearTimeout(settime);
????settime=setTimeout("redraw()",100);
???});? ???
???var p1 = $('body').layout('panel','west').panel({
????onCollapse:function(){
?????if(settime != null)
??????clearTimeout(settime);
?????settime=setTimeout("redraw()",100);
????},
????onExpand:function(){
?????if(settime != null)
??????clearTimeout(settime);
?????settime=setTimeout("redraw()",100);
????},
????onResize:function(width,height){
?????if(settime != null)
??????clearTimeout(settime);
?????settime=setTimeout("redraw()",100);
????}
???});????
???var p2 = $('body').layout('panel','east').panel({
????onCollapse:function(){
?????if(settime != null)
??????clearTimeout(settime);
?????settime=setTimeout("redraw()",100);
????},
????onExpand:function(){
?????if(settime != null)
??????clearTimeout(settime);
?????settime=setTimeout("redraw()",100);
????},
????onResize:function(width,height){
?????if(settime != null)
??????clearTimeout(settime);
?????settime=setTimeout("redraw()",100);
????}
???});?
??});
?</script>
</head>
<body>
?<body class="easyui-layout">
?<div region="north" border="false" style="height:30px;background:#B3DFDA;">north region</div>
?<div region="west" split="true" title="tree" style="width:150px;padding:10px;">west content</div>
?<div region="east" split="true" title="East" style="width:100px;padding:10px;">east region</div>
?<div region="south" border="false" style="height:20px;background:#A9FACD;">south region</div>
?<div region="center" border="true" title="center" style="border-left:0px;border-right:0px;">??
??<div class="easyui-layout" id="subWrap" style="width:100%;height:100%;background:#0A3DA4;">
???<div region="north" border="true" title="condtion" split="true" style="height:200px;background:#A9FACD;">
????<p style="font-size:48;margin:0px auto;text-align:center;">sub north region</p>
???</div>
???<div region="center" border="true" title="result" split="true" style="background:#E2E377;">
????<p style="font-size:48;margin:0px auto;text-align:center;">sub center region</p>
???</div>???
??</div>??
?</div>
?
</body>
</html>

  相关解决方案