PDA

View Full Version : problem with 4.1 and 4.1 beta 3



lafugacu78
8 Mar 2012, 1:27 AM
I marked in red running in ExtJS4.1 but does not workin 4.1beta 3
any idea


Ext.define('comercioApp.controller.modelo', {
extend : 'Ext.app.Controller',
stores : ['modelo', 'field_marca'],
models : ['modelo'],
views : ['op.modelo'],
refs : [{
ref : 'grid',
selector : 'opModelo'
}, {
ref : 'form',
selector : 'viewport > form'
}, {
ref : 'btnEliminar',
selector : 'opModelo button[action=deleteExp]'
}, {
ref : 'btnAdd',
selector : 'opModelo button[action=newExp]'
}],


init : function() {


this.control({


'opModelo' : {
render : this.onRender,
edit : this.onEdit,
selectionchange : this.onSelectionchange
},
'opModelo button[action=newExp]' : {
click : this.newExp
},
'opModelo button[action=deleteExp]' : {
click : this.deleteExp
}
});
},
onRender : function() {
alert('Render');
var store = this.getField_marcaStore();
var store1 = this.getModeloStore();
store.load({
callback : function() {
store1.load({
start : 0,
limit : 25
});
}
});
},
onEdit : function(editor, e, eOpts) {
//console.log('edit');
var store = this.getModeloStore();
var btnAdd = this.getBtnAdd();
if(e.record.isValid()) {
store.sync({
success : function() {store.findExact('id', 0) == -1 && btnAdd.setDisabled(false);
}
});
}
},
onSelectionchange : function(selecMode, selected, eOpts) {
//console.log('change');
this.getBtnEliminar().setDisabled(!selecMode.hasSelection());
},
newExp : function(button) {


var store = this.getModeloStore();
var grid = this.getGrid();
var newRec = this.getModeloModel().create();


store.add(newRec);
this.getGrid().getSelectionModel().select(newRec, false, false);
grid.plugins[0].startEdit(newRec, 0);
this.getBtnAdd().setDisabled(true);
},
deleteExp : function(button) {
var grid = this.getGrid();
var store = this.getModeloStore();
Ext.Msg.show({
title : 'Advertencia',
msg : '┐Realmente desea eliminar?',
buttons : Ext.Msg.OKCANCEL,
icon : Ext.Msg.QUESTION,
fn : function(btn) {
if(btn == 'ok') {
store.remove(grid.getSelectionModel().getSelection());
store.sync();
}
}
});


}
});

mitchellsimoens
8 Mar 2012, 4:40 PM
This has been fixed in our latest internal code that will be apart of the next release.

lafugacu78
8 Mar 2012, 10:55 PM
thanks for the reply.
I wait long to get the new code?
I am also interested in Ext.data.association.HasOne I think is the best way I wanna do