- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 GXT 3.0 的 XTemplates(类似于 EXT),这里有 2 个具有以下关系的简单 java 对象:
class A {
String name;
public String getName() {
return name;
}
}
class B {
String name;
public String getValue(A a) {
return a.getName();
}
}
我想为以下模板应用带有 2 个参数的 XTemplate(List<< A>> aList、List<< B>> bList):
<tpl for="aList">
<tpl for="bList">
////// Questions? How to call function B.getValue(A) ???
///// this does not work for me: {this.getValue(parent)}
</tpl>
</tpl>
有熟悉此类请求的机构吗?谢谢。
最佳答案
有一个特殊的命名对象可以帮助您处理这个问题,称为parent
- 它访问外部范围。
<tpl for="aList">
<tpl for="bList">
Name of inner item, i.e. b.getName() is {name} <br />
Name of outer item, i.e. a.getName() is {parent.name}
</tpl>
</tpl>
如果存在第三个循环,您可以将调用链接到父级以进一步退出 - parent.parent.name
。
如果 A 有 getPhone()
方法,但 B 没有,则 parent
是可选的,因为显然您不能引用非-存在b.getPhone()
。
this example中也使用了同样的原理。 ,其中打印了每个 child 以及 parent 的详细信息。查看 template.html
文件的源代码,了解在这种情况下如何使用 parent
。
关于java - Sencha GXT XTemplate tpl for inside tpl for,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13294443/
我定义了以下扩展 Ext.view.View 的类: Ext.define('Aft.view.comments.CommentsList', { extend: 'Ext.view.View',
我定义了以下扩展 Ext.view.View 的类: Ext.define('Aft.view.comments.CommentsList', { extend: 'Ext.view.View',
我正在测试 extjs 4 并且我偶然发现了一些东西,我似乎无法弄清楚。 我有简单的对象关联:快照 - hasMany -> 模型 现在,我尝试使用 XTemplate 在 View 组件中显示此关联
我正在创建一个带有模板的组件。我想在该模板中调用一个返回另一个模板的函数,并将该模板连接到另一个模板中。我不知道如何执行此操作,因为我刚刚学习如何使用模板。 所以这是一个简单的代码,就像我想做的那样。
我有一个 ExtJS 面板,它显示几位数据并且需要经常更新。例如,显示 DOW、NYSE、NASDAQ 等当前市场价格的面板。 考虑到数据会频繁更新(至少每秒更新一次),更新数据字段的单个元素与每次使
您好,我使用 sencha touch 2,但在使用 Ext.XTemplate 时遇到了一些问题。 当我使用下一个模板并且它正常工作时: var template = new Ext.XTempla
我正在尝试使用 XTemplate 显示 Grid 的行信息: List users = new ArrayList(); users.add(new User("John", "Sm
在我使用 XTemplate 之前,以下示例显示了正常的组合框。应用 XTemplate 组合框项目后变得无法点击(悬停时没有突出显示,也没有通过点击选择)。 Ext.onReady(func
我正在使用 extjs 6 制作图片库的原型(prototype)。 I've got the basic layout setup in a fiddle ,但我不确定如何(或是否可以)向图库中的每
我正在使用 EXTJS 4.2.2 构建一个网络应用程序,不幸的是我不得不说我在这里的技能很差。 我有一个工具栏,它是一个水平菜单(配置文件、按钮、通知列表、选项列表、关于、帮助等),这个菜单中的按钮
我有以下 Xtemplate 代码: ('Ext.XTemplate', '', '', '', '{merchName}'
我使用以下方法在容器中动态添加组件:this.add() 方法代码: init: function() { var combo = new Ext.BoxComponent({
我想使用 Ext JS XTemplate 在屏幕上显示一个带有表格的列表。 这些是我的配置, 读者: var readerX = new Ext.data.JsonReader({ successP
我有以下问题:我正在一个复杂的 XTemplate 中显示我的 GXT 项目的数据。 @XTemplate(source = "DepictionDisplay.html") SafeHtml
我尝试在 Ext XTemplate 中进行计算。根据我阅读的文档,使用一个简单的 {x + y} 标签是可能的,但是它不适用于 2 个变量,所以我尝试使用 {[x + y]} 来做,但是之后模板渲染
我在定义 View 时尝试使用XTemplate,虽然我不知道我是否正确使用它,这是我的代码: East.js Ext.define('MyApp.view.main.East', { exten
我是 ExtJS 开发的新手。我有来自 2 个不同数据存储的数据(例如:DepartmentsStore 和EmployeesStore)。我试图在父表中显示部门列表,并将每个部门内的所有员工作为嵌套
我正在尝试使用 extjs xtemplate 循环一个数组并创建一个表 Ext.define('dataview_model', { extend : 'Ext.data.Model'
我想使用 Ext 的 String一些将输出到 View 的文本的方法。 例如: itemTpl: [ ... '', '', '{post_text_teas
谁能给我一个例子,说明如何在 Extjs 中使用 XTemplate 来包含特定的 css 类? 5000"> yellow css red css 编辑:我有这样的东西 new
我是一名优秀的程序员,十分优秀!