我正在extjs4中工作。我已经GRIDVIEW为=Extjs4链接点击功能错误
{
margin : '10 0 5 100',
xtype : 'grid',
id : 'g2',
//title : 'Educational Details',
store : 'qb.qbquestionoptionStore',
columns : [ {
text : 'Options',
dataIndex : 'option',
flex : 1
}, {
text : 'Answer',
dataIndex : 'isAnswer',
flex : 2.5
},{
header : 'edit',
renderer : function(val) {
return '<a href="#" id="edit">Edit</a>';
}
},
{
header : 'Remove',
renderer : function(val) {
return '<a href="#" id="remove">Remove</a>';
}
}
对于这些上述编辑和删除链接我已经编写的代码在控制器原样
deleterow:功能(CMP){ cmp.mon(cmp.getEl(),'点击”功能(事件,目标){
if (target.id == 'edit') {
console.log('edit');
listview = Ext.getCmp('g2');
listview.on({
itemClick : function(dv, record, item, index, e, opts) {
var view = Ext.widget('useredit');
view.down('form').loadRecord(record);
}
});
}
if (target.id == 'remove') {
//alert("hello");
listview = Ext.getCmp('g2');
listview.on({
itemClick : function(dv, record, item, index, e, opts) {
//var grid = button.up('g3');
var store = listview.getStore();
var selected = listview.getSelectionModel()
.getSelection();
console.log(selected);
if (selected && selected.length == 1) {
store.remove(selected);
console.log(store);
}
}});}}, this, {
delegate : "a"
});},
但在两个链接点击,同样的编辑链接功能正在执行。因此,如何在特定的链接点击执行特定的功能?
thanx的答复先生。 ..我有app.js as =“Ext.applic通货膨胀({ 要求:[ 'Ext.container.Viewport'], 名: 'Balaee', appFolder: '应用', \t \t控制器:[ \t \t \t \t \t“Balaee.controller.qb。 qbquestionController” \t \t \t \t \t], 推出:函数(){ Ext.create( 'Ext.container.Viewport', {布局: '自动', 项目:{ \t \t \t \t \t \t 的xtype: 'EditView中'} });因此当我写onclick =“Balaee.app.getController(\'qb.qbquestionController \')。editRow()”,它给我的错误为“Balaee.app未定义”所以如何?您正在使用什么版本的ExtJS的4.2修改 – user1722857
,你的application.js文件应该看起来更像是这样的: Ext.define( 'Balaee.Application',{ 名称: 'Balaee', 扩展:' Ext.app.Application', controllers:[ 'qb。qbquestionController” ], \t 发射:函数(){ Ext.create( 'Ext.container.Viewport',{ 布局: '自动', 项:{的xtype: 'EditView中'} }); } }); – kevhender
先生,我正在使用extjs4.0版本。 – user1722857