
var records=myStorefindRecord("id", thisgetValue())getData();
alert(recordsage)
在grid中添加监听函数,监听单元格点击cellclick,使用如下代码即可实现。
//EXT GridPanel获取某一单元格的值listeners:{
'cellclick':function(grid, rowIndex, columnIndex, e){
editCell_row = rowIndex;
editCell_col = columnIndex;
var record = gridgetStore()getAt(rowIndex);
var fieldName = gridgetColumnModel()getDataIndex(columnIndex);
var data = recordget(fieldName);
alert(record+fieldName+data);
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
var securityTypeIDValue = ExtgetCmp('securityTypeCombo')getValue();
// 获取显示值
var securityTypeDisValue = ExtgetCmp('securityTypeCombo')getRawValue();
// Combox定义
/Combox start/
var securityTypeRecord=[
{name : 'SAVE_VALUE',type : 'string'},
{name : 'DISPLAY_VALUE',type : 'string'}
];
var securityTypeRecordHeads = ExtdataRecordcreate(securityTypeRecord);
var securityTypeDatastore = new ExtdataStore( {
proxy:new Extdata>
reader : new ExtdataJsonReader( {
root : 'root'
}, securityTypeRecordHeads),
remoteSort : false
});
securityTypeDatastoreload();
var securityTypeCombo = new ExtformComboBox({
id:'securityTypeCombo',
width:110,
forceSelection : true,
selectOnFocus: true,
triggerAction: 'all',
mode: 'local',
store: securityTypeDatastore,
allowBlank: true,
valueField : 'SAVE_VALUE',
displayField : 'DISPLAY_VALUE',
emptyText:'---请选择---'
});
11:数据对应的列,加了一个点击事件,获取到该列的值,然后赋值
{
align: 'center',
text: 'A,
dataIndex: 'A',
width:60,
renderer : function(val, meta, record) {
val = "<a href='javascript:;' >"+val+"</a>";
metatdAttr = 'data-qtip="' + val + '"';
return '<div align="left">' + val + '</div>';
},
listeners:{
'click':function(){
var rows = gridgetSelectionModel()getSelection();
displayfieldsetValue(rows[0]get('A'));//通过rows[0]get('字段名')来获取A字段的值,然后赋值给displayfield
}
}
2如果有点击事件的话,你可以直接使用 var rows = gridgetSelectionModel()getSelection();获取store的数据模型(存放了所有的记录),rows[0]是指定行的记录(包括隐藏的字段),displayfield这个在grid外面创建好的,在grid可以引用到的话可以直接使用 displayfieldsetValue(rows[0]get('A'));来赋值
3
var display = Extcreate('ExtformfieldDisplay',{
xtype: 'displayfield',
fieldLabel: 'Visitor',
name: 'visitor_score',
value: '11'
})
var grid = Extcreate('ExtgridPanel', {
store: store,
columns: [
{text : 'Company',
flex : 1,dataIndex: 'company',
renderer : function(val, meta, record) {
val = "<a href='javascript:;' >"+val+"</a>";
return val;
},
listeners:{
'click':function(){
var rows = gridgetSelectionModel()getSelection();
displaysetValue(rows[0]get('name'))
}
}
} ], dockedItems: [{
xtype: 'toolbar',
dock: 'top',
items: [display]
}]
});
});
首先获取下拉框的值ExtgetCmp("q_jg")getValue(),这步应该没问题吧
然后,调用以下方法,进行替换。我这是性别的例子,楼主对照这改改就好
function gridUserType(value) {
var inx = sexStoregetCount();
for ( var i = 0; i < inx; i++) {
var rec = sexStoregetAt(i);
if (recget("id") == value) {
return recget("name");
}
}
}
以上就是关于Extjs4 中store取值问题,涉及combobox全部的内容,包括:Extjs4 中store取值问题,涉及combobox、extjs 如何取grid中单元格的值、extjs 怎么获取combox下拉框中选中的值等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)