- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用Ext.dataview.component.ListItem
在sencha touch 2.3
(使用sencha架构师)中构建一个列表。我能够使用 updateRecord 方法从商店获取值,但是我无法将其传递回主组件。
这就是我想要实现的目标:-
我想创建一个按钮列表,其文本将从商店动态显示,如果用户单击它,它应该显示带有年龄的警报。我有一家商店,里面有名字和年龄。我能够获取名称,但无法获取警报设置。我需要帮助-这是我的 dataView 类
Ext.define('MyListItem.view.MyListItem', {
extend: 'Ext.dataview.component.ListItem',
alias: 'widget.mylistitem',
requires: [
'Ext.Button',
'Ext.MessageBox'
],
config: {
padding: 10,
layout: 'hbox',
items: [
{
xtype: 'button',
handler: function(button, e) {
var record = this.getRecord();
console.log("buttonTapped");
console.log(record);
Ext.Msg.alert(
record.get('name'), // the title of the alert
"The age of this person is: " + record.get('age') // the message of the alert
);
},
text: 'MyButton'
},
{
xtype: 'component',
flex: 1,
html: 'Sample component inside dataitem'
}
]
},
updateRecord: function(record) {
// Provide an implementation to update this container's child items
var me = this;
me.down('button').setText(record.get('name'));
}
});
这是我的商店:-
Ext.define('MyListItem.store.MyDirectStore', {
extend: 'Ext.data.Store',
requires: [
'MyListItem.model.MyModel'
],
config: {
data: [
{
name: 'Adam',
age: '28'
},
{
name: 'Eve',
age: '27'
}
],
model: 'MyListItem.model.MyModel',
storeId: 'MyDirectStore'
}
});
最佳答案
我猜你的问题是你无法像使用 this.getRecord()
那样从处理函数中检索记录
您也可以使用年龄更新按钮,然后检索它以显示警报,例如:
{
xtype: 'button',
handler: function(button, e) {
console.log("buttonTapped");
Ext.Msg.alert(
button.getText(), // the title of the alert
"The age of this person is: " + button.getAge(); // the message of the alert
);
},
text: 'MyButton',
age: null
},
还有:
updateRecord: function(record) {
// Provide an implementation to update this container's child items
var button = this.down('button');
button.setText(record.get('name'));
button.setAge(record.get('age'));
}
更好的是,将信息或对记录的引用存储在更合适的位置,例如 ListItem
本身?但这应该可以正常工作。
关于javascript - Sencha 2.3 中使用架构师的 DataView 组件列表项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21971548/
这是我的 Dataview.List 这是我的 Dataview.Dataview 我想显示我的 Dataview.dataview 中的元素,就像我的 Dataview.List 中的元素一样。我只
我想通过过滤现有的 DataView 创建一个新的 DataView,但是我遇到了麻烦,因为 DataView 没有 .AsEnumerable() 方法并且没有实现 IEnumerable{Data
我想用如下状态和功能扩展 DataView: export class MyDataView extends DataView { public position: number; p
我正在使用 dataview 并使用它的 skip 和 take 方法,这将占用 5 行并根据页码和页面大小跳过一些行。 //creating a dataview object and assign
我正在为我的图片库使用 ExtJS DataView。这是我的项目工具提示方式。它在 tpl 中。 new Ext.XTemplate( '', '',
我无法在不转换的情况下查询 DataView。 IsPresent 方法中的两行代码取自 "LINQ - Specified cast is not valid with dataview use "
在我的应用程序中,我使用数据 View 在动态传递过滤器选项的地方应用过滤器。如果有 2 个过滤器参数,则数据 View 应针对参数 1 进行过滤,然后按参数 2 进行过滤。我正在使用一种在 for
我在我的页面上显示来自 DataTable 的信息,并想添加一些排序功能,这比直接的列排序要稍微好一点。因此,我一直在尝试将 LinkButtons 放在我的 GridView 的 HeaderI
我有两个要排序的 DataView,在 dgtest1 中,我尝试对包含 Typeid != 25 的数据进行排序,在 dgtest2 中我试图只显示 Typeid == 25 处的数据。 当我单步执
DataView 对象没有像 DataTable 那样的 Rows 属性。 如何循环遍历 DataView 的行? 最佳答案 DataView 对象本身用于循环遍历 DataView 行。 DataV
我正在尝试关注 http://mleibman.github.com/SlickGrid/examples/example4-model.html本教程。我下载了所有必需的 .js 文件(core.j
如何在顶部而不是默认在底部添加新行,在 slickgrid dataview impelmentation 中也很感激有人提供删除行的示例。 最佳答案 这是一个示例函数,可以与示例 1-simple.
我有一个数据表。我想按列名“城市”对其默认 View 进行排序。我希望排序不区分大小写。 这是我的代码: DataTable dt = GetDataFromSource(); dt.DefaultV
我有一个包含一列(“利润”)的数据表。我想要的是获取此表中所有值的总和。我试图通过以下方式做到这一点...... DataTable dsTemp = new DataTable(); dsTemp.
我在 DataView.Sort 上遇到性能瓶颈。代码如下。 /// /// Filters the data table and returns a new data table
我正在尝试确定 DataView 是否不包含数据。 lsSql = "Select col1, col2 from table where tableId = " + Id; DataView l
我有一个 DataTable包含一些行。复制到 DataView .现在我有 List 形式的 ID .其中包含从 GridView 中选择的项目.现在我想过滤这个 DataView使用 AND 作为
我有一个包含一些列的 gridview,我需要按日期列对 gridview 进行排序。但我无法正确排序。这是我使用的代码: dt.DefaultView.Sort = "Meldingsdatum a
我想将数据 View rowfilter 值转换为数据表。我有一个有值(value)的数据集。现在我正在使用数据 View 过滤值。现在我想将数据 View 过滤器值转换为数据表。请帮我复制它....
我有一个数据 View 。 dataview 的来源是来自 sql server 的 view。Dataview 已排序。像这样: dv_building.Sort = "bld_number" 此
我是一名优秀的程序员,十分优秀!