ext Js 很奇怪的问题 100分

Owenini 2012-03-26 11:55:51
遇到这样问题

我用 ajax 加载如下javascript脚本

var Test= new Ext.Panel({
title: "订餐",
height:100

});

var orderingMealPanel = new Ext.Panel({
title: "订餐",
tbar: orderingMealToolbar,
items: [Test]
});


但执行 orderingMealPanel 添加不上 Test 面板 如果是 直接 <script src =""> 这样方式引用就可以,请问为什么!!!
...全文
200 18 打赏 收藏 转发到动态 举报
写回复
用AI写文章
18 条回复
切换为时间正序
请发表友善的回复…
发表回复
xsxtchenz 2012-03-28
  • 打赏
  • 举报
回复
renderTo呢?????
licai1210 2012-03-27
  • 打赏
  • 举报
回复
var Test= new Ext.Panel({
title: "订餐Test",
height:100
});

var orderingMealPanel = new Ext.Panel({
title: "订餐panel",
tbar: orderingMealToolbar,
height:200,
width:200,
items: [Test]
});
试试

syxfqw7 2012-03-27
  • 打赏
  • 举报
回复
[Quote=引用 16 楼 syxfqw7 的回复:]

不好意思 上面没看清楚
第一。你的Panel没渲染。第二你的tbar貌似有问题

Ext.onReady(function(){
var Test= new Ext.Panel({
title: "订餐",
height:100


});

var orderingMealPanel = new Ext.Panel({
title: "订餐",
// ……
[/Quote]
我又测了下。如果你放在Ext.onReady里面的话,不写渲染也能出,不过最好是加上
syxfqw7 2012-03-27
  • 打赏
  • 举报
回复
不好意思 上面没看清楚
第一。你的Panel没渲染。第二你的tbar貌似有问题

Ext.onReady(function(){
var Test= new Ext.Panel({
title: "订餐",
height:100


});

var orderingMealPanel = new Ext.Panel({
title: "订餐",
// tbar: orderingMealToolbar,
renderTo:Ext.getBody(),
height:200,
items: [Test]
});
});
这样是可以的
syxfqw7 2012-03-27
  • 打赏
  • 举报
回复
楼主,我悄悄的告诉。
因为items里面放的Panel对象。
所以呢,可以这么写
items:[new Ext.Panel({
title:'test',
height:200

})]
或者你在外面定义一个
var p1=new Ext.Panel({
title:'t1',
height
});
items:[p1]

懂了没?你可以查下你的API
zhangxianya1 2012-03-27
  • 打赏
  • 举报
回复
items: [Test]
是这个有问题,你好好检查一下
bohe_198878 2012-03-27
  • 打赏
  • 举报
回复
一个简单的渲染布局问题怎么会有这么多答案
  • 打赏
  • 举报
回复
[Quote=引用 11 楼 fanchuanzhidu 的回复:]

楼主尚未了解到Ext渲染的过程
new了panel 面板已经被渲染出来了 把已经渲染后的对象放到items里 您觉得对么?
正常的思路:
通过ajax动态构造items中的对象(不是new出来的 是js对象) push到items数组中去 最后渲染主面板
[/Quote]

兄台,对象new出来还没有渲染吧?如果本身没有设置render或者调用render方法,是由他的容器来控制渲染的
不知道说的对不对
豆虫 2012-03-27
  • 打赏
  • 举报
回复
楼主尚未了解到Ext渲染的过程
new了panel 面板已经被渲染出来了 把已经渲染后的对象放到items里 您觉得对么?
正常的思路:
通过ajax动态构造items中的对象(不是new出来的 是js对象) push到items数组中去 最后渲染主面板
  • 打赏
  • 举报
回复
ajax加载脚本是啥意思?loader?
如果是loader的话,必须是component的方式,所返回的所有文本extjs都将执行component的add操作,不合法的将异常,不显示UI
dataminer_2007 2012-03-26
  • 打赏
  • 举报
回复
items: [Test], 试试去掉中括号
Owenini 2012-03-26
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 yaya203 的回复:]

var Test= new Ext.Panel({
title: "订餐Test",
height:100

});

var orderingMealPanel = new Ext.Panel({
title: "订餐panel",
tbar: orderingMealToolbar,
height:200
items: [Test]
});

……
[/Quote]


真的 不可以啊 可以 加下 QQ 我发给你源码 你帮我测试下 至于你会说 凭什么帮你。。。。。。我。。。。。
yaya203 2012-03-26
  • 打赏
  • 举报
回复
var Test= new Ext.Panel({
title: "订餐Test",
height:100

});

var orderingMealPanel = new Ext.Panel({
title: "订餐panel",
tbar: orderingMealToolbar,
height:200
items: [Test]
});

你先看看效果 应该是可以出来的,
你的那个之所以没有处理 ,是因为你出来了 你没有看到
likeajin 2012-03-26
  • 打赏
  • 举报
回复
没弄清你的题……再描述详细点吧。
Owenini 2012-03-26
  • 打赏
  • 举报
回复
我顶。。。。。。。。。顶。。。。。。。。。。没力气了。。。。。。。。。。。。
Acesidonu 2012-03-26
  • 打赏
  • 举报
回复
学习ext
冰镇宝贝321 2012-03-26
  • 打赏
  • 举报
回复
待着学习学习

87,910

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧