Results 1 to 2 of 2

Thread: Nested records state change only after key event.

  1. #1
    Sencha User olivierpons's Avatar
    Join Date
    Dec 2009
    Location
    Aix en Provence,France
    Posts
    125
    Answers
    7

    Default Nested records state change only after key event.

    Hi,

    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.

    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:

    01.png

    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:

    02.png

    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:

    Code:
        var storeAfterWrite = function(proxy, operation) {
            if ( (operation.action == 'create') ||
              (operation.action == 'update') ) {
              /* go to the record */
              var m = this.getById(
                parseInt(operation.resultSet.records[0].internalId)
              );
            }
            else if (operation.action == 'destroy') {
              /* Go to first record : */
              var m = this.getAt(0);
            }
            if (m) {
              /* select record : */
              this.panelGridEtEdit.gsGrid.getSelectionModel().select(m);
            }
            else {
              /* make sure nothing is selected */
              this.panelGridEtEdit.gsGrid.getSelectionModel().deselectAll();
            }
            Ext.example.msg(
                Ext.String.capitalize(operation.action),
                operation.resultSet.message
            );
        };
    Here's the declaration of storeProduits.

    Code:
        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:


    03.png


    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:




    04.png

    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.

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,450
    Answers
    3997

    Default

    Are you talking about the red triangles? If so that just means the records weren't commit() after changing the data.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Fullstack Engineer
    ________________
    Modus Create is based on the model of an open source team. We’re a remote, global team of experts in our field. To find out more about the work we do, head over to our website.

    Check out my GitHub:
    https://github.com/mitchellsimoens

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •