Merge pull request #1569 from cheloheredia/BUG-11086

BUG 11086 "Rows are being ignored after adding them next to an empty row" SOLVED
This commit is contained in:
julceslauhub
2013-04-17 07:23:51 -07:00

View File

@@ -90,6 +90,11 @@ Ext.onReady(function(){
_fields.push({name: _idProperty});
for (i=0;i<tableDef.FIELDS.length; i++) {
if (tableDef.FIELDS[i].FLD_KEY==1) {
blank=false;
} else{
blank=true;
};
switch (tableDef.FIELDS[i].FLD_TYPE) {
case 'DATE':
columnRenderer = function (value) {
@@ -104,7 +109,7 @@ Ext.onReady(function(){
columnEditor = {
xtype : 'datefield',
format : 'Y-m-d',
allowBlank : true
allowBlank : blank
};
break;
@@ -114,7 +119,7 @@ Ext.onReady(function(){
columnEditor = {
xtype : 'numberfield',
decimalPrecision : 8,
allowBlank : true
allowBlank : blank
};
break;
@@ -123,7 +128,7 @@ Ext.onReady(function(){
columnAlign = 'left';
columnEditor = {
xtype : 'textfield',
allowBlank : true
allowBlank : blank
};
}
@@ -182,13 +187,13 @@ Ext.onReady(function(){
editor = new Ext.ux.grid.RowEditor({
saveText : _("ID_UPDATE"),
listeners : {
afteredit : {
fn:function(rowEditor, obj, data, rowIndex ){
if (data.phantom === true) {
//store.reload(); // only if it is an insert
}
}
}
afteredit : {
fn:function(rowEditor, obj, data, rowIndex ){
if (data.phantom === true) {
//store.reload(); // only if it is an insert
}
}
}
}
});
}
@@ -396,12 +401,30 @@ NewPMTableRow = function(){
var row = new PMRow(new props);
len = infoGrid.getStore().data.length;
editor.stopEditing();
store.insert(len, row);
infoGrid.getView().refresh();
infoGrid.getSelectionModel().selectRow(len);
editor.startEditing(len);
if (len>0) {
var emptyrow=0;
for (var i = 0; i < tableDef.FIELDS.length; i++) {
if (infoGrid.store.getAt(len-1).data[tableDef.FIELDS[i].FLD_NAME]=="") {
emptyrow++;
};
};
if (emptyrow==tableDef.FIELDS.length) {
PMExt.error( _('ID_ERROR'), _('ID_EMPTY_ROW'));
store.load();
} else{
editor.stopEditing();
store.insert(len, row);
infoGrid.getView().refresh();
infoGrid.getSelectionModel().selectRow(len);
editor.startEditing(len);
}
} else{
editor.stopEditing();
store.insert(len, row);
infoGrid.getView().refresh();
infoGrid.getSelectionModel().selectRow(len);
editor.startEditing(len);
}
};
//Load PM Table Edition Row Form