View Full Version : Nested records state change only after key event.

12 Apr 2012, 6:50 AM

Before explaining my problem, it's important to say that I'm using my overriden JSON writer object for nested records you can find here (http://www.sencha.com/forum/showthread.php?141957-Saving-objects-that-are-linked-hasMany-relation-with-a-single-Store&p=765331&viewfull=1#post765331).

I've done a "main" grid, with a form linked to this grid.

In this form, there's a nested grid which is linked to a nested field of the "main" grid.

Like this:


I've added the possibility to add another attribute: "Ajouter un attribut" means "Add an attribute".

When the users clicks on this button, I've made a selection on it:


If you validate, it works perfectly, and it's sent to the server, with all the fields included. I'm using the property "writeAllFields: true" to send it automatically.

So, once it's sent, I've added a listener that brings back to the "updated" record, with this function storeAfterWrite. So this code:

var storeAfterWrite = function(proxy, operation) {
if ( (operation.action == 'create') ||
(operation.action == 'update') ) {
/* go to the record */
var m = this.getById(
else if (operation.action == 'destroy') {
/* Go to first record : */
var m = this.getAt(0);
if (m) {
/* select record : */
else {
/* make sure nothing is selected */

Here's the declaration of storeProduits.

var storeProduits = Ext.create('Ext.data.Store', {
model: 'Intranet.Produit',
autoLoad: true,
autoSync: true,
proxy: {
... blabla ...
listeners: {
write: storeAfterWrite

It's added, and there's no problem:


But the damn weird thing is that, after adding something into a the nested list, as long as I click with the mouse on a record of the "main" grid, everything works fine, but if I move with the keyboard (arrow keys up and down), the nested list appears like this:


Do you know where this could come from, and where I should look?

Once again, NB: I'm using my overriden JSON writer object for nested records you can find here (http://www.sencha.com/forum/showthread.php?141957-Saving-objects-that-are-linked-hasMany-relation-with-a-single-Store&p=765331&viewfull=1#post765331).

13 Apr 2012, 7:41 AM
Are you talking about the red triangles? If so that just means the records weren't commit() after changing the data.