1

Why when I open my form through a window and I change nothing and I agree, my grid item stacks instead of recharged my grid? but I change the values ​​of my form and I agree, my grid is reloaded correctly?

Thanx in advance

EDIT : Store.sync returns an error if you do not change the data

The picture of the bug

My code:

var modele = Modeles[activeTabParametresApplicatifs]; // Ex: Name
var id = 'Id'+modele; // IdName
var chaine = activeTabParametresApplicatifs; // TabNames
var store = chaine.substr(3,chaine.length); // Names

eval ('record = Ext.create(\'ModuleGestion.model.'+modele+'\');');
eval ('store = this.get'+store+'Store()');

var win    = button.up('window'),
    form   = win.down('form');
record = form.getRecord();
values = form.getValues();

eval ('var id = values.'+id);



if (form.isValid()) {

    if (id > 0){
        record.set(values);

    } else{
        record.set(values);
        store.add(record);

    }

    store.sync({
        success : function() {
            store.load();
        }
    });

    win.close();

}
VincentDA
  • 159
  • 1
  • 14

1 Answers1

0

Dude! Following your code is like tracking a Bigfoot! Why all those pointless evals?

Start by replacing that:

eval ('var id = values.'+id);

With that:

id = values.id;

Then remove all the other evals, and quit the habit of using them now.

Ok, sorry for this outburst but you were really going down a very dangerous road. So, regarding your question, just a wild guess considering the lack of context, but couldn't the culprit be this line:

store.add(record);
rixo
  • 23,815
  • 4
  • 63
  • 68
  • And does the problem persist if you remove it? – rixo Jun 06 '13 at 23:47
  • I'm sorry, I'm afraid I won't be able to help much more. In part because I don't understand what you want to say. You know, if you don't master English language, you should just post a working and **complete** code example (like we can copy-paste and run it), and concentrate on saying (1) what you want (2) what you get instead. I'm sure you would get useful answers this way. – rixo Jun 07 '13 at 00:44
  • if i delete store.add, it's equal same bug – VincentDA Jun 07 '13 at 00:47
  • ...entre lyonnais on devrait ce comprendre pourtant ahaha – VincentDA Jun 07 '13 at 00:48