1. #1
    Sencha User
    Join Date
    Jul 2012
    Posts
    33
    Vote Rating
    0
    santosr666 is on a distinguished road

      0  

    Default Keep grid selection even when record has been modified

    Keep grid selection even when record has been modified


    Hi guys,

    Hope some of you can shed some light to my problem:

    I have grid and when some row is selected the row information is loaded into an edit panel outside the grid. In this panel user can modify the record and save his changes. This will reload my grid and here come my issue:
    I need to have the very same record selected in the grid after reloading.

    why is that complicated:
    (1) record id is Ext stuff, so I can't store the id and select it again on reloading, 'cause id will change;
    (2) also, the grid can be ordered by any column and columns have information that might be modified in the edit panel, so, even keeping the same order parameter, the order might change as well and thus I could not store row id;
    (3) moreover, what if the change in the record modify the page the record will be? How to control and set the correct page?

    Until now, I just have the row id stored like below:

    Code:
    // my extended GridPanel
    
    initComponent: function() {
      selectedRecords: [],
      reselect: function(){return false;},
    
    
      // lots of stuff
    
      this.getStore().on('beforeload', this.rememberSelection, this);
      this.getView().on('refresh', this.refreshSelection, this);
    }
    
    rememberSelection: function(selModel, selectedRecords) {
        this.selectedRecords = this.getSelectionModel().getSelections();
    
    
        for (var i = 0; i < this.selectedRecords.length; i++) {
           this.selectedRecords[i] = this.store.indexOf(this.selectedRecords[i]);
        }
    
    
        this.reselect = function() {
          for (var i = 0; i < this.selectedRecords.length; i++) {
            this.getSelectionModel().selectRow(this.selectedRecords[i]);
          }
        }
      },
    
    
      refreshSelection: function() {
          this.reselect();
      }
    // other stuff
    Any help/hint will be very usefull.

    Cheers!

  2. #2
    Sencha User
    Join Date
    Jul 2012
    Posts
    33
    Vote Rating
    0
    santosr666 is on a distinguished road

      0  

    Default


    Guess I realize the problem can't be solved in client side.

    With the pagination I don't have all the items in the client context to be able to select one of them by some key ... I meant ... after record has been changed I can't guarantee it will be available in the next response. And if it is how could I know with only one query in which page should I put it ???

  3. #3
    Sencha User
    Join Date
    Apr 2012
    Posts
    10
    Vote Rating
    1
    nareshurs is on a distinguished road

      0  

    Default


    Hi Santosh,

    I am facing the same problem. Did you find any solution to this.

    Regards,
    Naresh

  4. #4
    Sencha User
    Join Date
    Jul 2012
    Posts
    33
    Vote Rating
    0
    santosr666 is on a distinguished road

      0  

    Default


    Yes ... Kind of ;-)

    I did a pagination stored procedure and current page information has been added to my json.

    The procedure receives a sysref cursor built with the select statement and the rowid from the record I want to find as parameters.

    So, in the first page load rowid is null and the procedure returns the first page.

    Any time the selected record is being changed and the refresh/reload of the grid is called the rowid is sent in the Ajax request. Then, the stored procedure do the pagination search until it finds the page where current record belongs to. If not found, first page is returned. When found, all records and current page are returned (it is a pipelined oracle procedure).

    Finally, in the front end, the paging toolbar is set to current page. I'd already have the total size info in my json so pagination goes smoothly.

    Hope that helps!

Thread Participants: 1

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar