1. #1
    Ext JS Premium Member Elijah's Avatar
    Join Date
    Nov 2009
    Location
    USA
    Posts
    382
    Vote Rating
    0
    Elijah is on a distinguished road

      0  

    Question If a row is selected and the data refreshes and the record is gone what happens?

    If a row is selected and the data refreshes and the record is gone what happens?


    Easy answer would be to change the data and see, however I dont have access to modifying the data (dont ask).

    Wondering what occurs when a user selects a record in the GridPanel and reloads the datastore (not the browser).
    I know that when it is reloaded the selected row gets selected again.
    But, what happens if the record was removed since last load?
    Does the GridPanel select the row based on the actual content of the row? or does the GridPanel select the row based on the row index?

    If user selects row 3 which contains data: RED and reloads the store and RED has been removed from the store will the grid still select row 3 which contains data: BLUE? OR nothing gets selected

    I am unable to test this currently until somebody fixes the management tool and want to know if this is something I am to test for or not.

  2. #2
    Sencha User fay's Avatar
    Join Date
    Apr 2007
    Location
    Ireland
    Posts
    1,750
    Vote Rating
    9
    fay will become famous soon enough fay will become famous soon enough

      0  

    Default


    From what I can see in the code for RowSelectionModel, it is based on rowIndex. See onRefresh:

    Code:
     
        onRefresh : function(){
            var ds = this.grid.store, index;
            var s = this.getSelections();
            this.clearSelections(true);
            for(var i = 0, len = s.length; i < len; i++){
                var r = s[i];
                if((index = ds.indexOfId(r.id)) != -1){
                    this.selectRow(index, true);
                }
            }
            if(s.length != this.selections.getCount()){
                this.fireEvent('selectionchange', this);
            }
        },

  3. #3
    Ext JS Premium Member Elijah's Avatar
    Join Date
    Nov 2009
    Location
    USA
    Posts
    382
    Vote Rating
    0
    Elijah is on a distinguished road

      0  

    Default


    Performing an API search for 'onRefresh' yields nothing. Where are u looking in the API that you saw that?

    Quote Originally Posted by fay View Post
    From what I can see in the code for RowSelectionModel, it is based on rowIndex. See onRefresh:

    Code:
     
    onRefresh : function(){
    var ds = this.grid.store, index;
    var s = this.getSelections();
    this.clearSelections(true);
    for(var i = 0, len = s.length; i < len; i++){
    var r = s[i];
    if((index = ds.indexOfId(r.id)) != -1){
    this.selectRow(index, true);
    }
    }
    if(s.length != this.selections.getCount()){
    this.fireEvent('selectionchange', this);
    }
    },

  4. #4
    Sencha User fay's Avatar
    Join Date
    Apr 2007
    Location
    Ireland
    Posts
    1,750
    Vote Rating
    9
    fay will become famous soon enough fay will become famous soon enough

      0  

    Default


    onRefresh is a private method of RowSelectionModel so won't be in the API docs. See line 71054 in ext-all-debug-w-comments.js.

  5. #5
    Ext JS Premium Member Elijah's Avatar
    Join Date
    Nov 2009
    Location
    USA
    Posts
    382
    Vote Rating
    0
    Elijah is on a distinguished road

      0  

    Default


    ROFL!
    Thats just too damn funny. Methods that people will never know about unless they reverse engineer whats been done.

    Quote Originally Posted by fay View Post
    onRefresh is a private method of RowSelectionModel so won't be in the API docs. See line 71054 in ext-all-debug-w-comments.js.

  6. #6
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,506
    Vote Rating
    54
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Quote Originally Posted by Elijah View Post
    ROFL!
    Thats just too damn funny. Methods that people will never know about unless they reverse engineer whats been done.
    Yep. That's the best way to know software. To understand it. It's not rocket science. It's just Javascript.

    And it's all broken down into reasonably sized classes.

    Just look at RowSelectionModel.js

    It's only 500 lines of which at least 200 is comments.

    You should be able to see how it works.

    So yes, I'm ROFLing at people who close off this to themselves, and refuse to learn.

  7. #7
    Ext JS Premium Member Elijah's Avatar
    Join Date
    Nov 2009
    Location
    USA
    Posts
    382
    Vote Rating
    0
    Elijah is on a distinguished road

      0  

    Default


    Well, thanks for the file name to review, but aside from that, I must disagree with you on this Animal. A library with an API is suppose to cover how the items are to be used. I agree its not rocket sciene but to expect people to just go look into source code for something that may or may not be there and for them to not know what they are looking for exactly because they don't know if it exists just to see if it exists is just well beyond reason. I've run into this kind of stuff many times in the past where it's like saying
    "I am looking to perform X and I am not sure if the library I am using can do it, but I know if I look into every file thats in the library for the term that I think it will be called (I don't know what they may list it under), I may not waste a whole lot of time and get the answer I am looking for. Then again I might not"
    Convoluted.

    Quote Originally Posted by Animal View Post
    Yep. That's the best way to know software. To understand it. It's not rocket science. It's just Javascript.

    And it's all broken down into reasonably sized classes.

    Just look at RowSelectionModel.js

    It's only 500 lines of which at least 200 is comments.

    You should be able to see how it works.

    So yes, I'm ROFLing at people who close off this to themselves, and refuse to learn.

  8. #8
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,506
    Vote Rating
    54
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    I've read and stepped through nearly every line of source in the library. You just get to know how it works.

  9. #9
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,361
    Vote Rating
    81
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    Quote Originally Posted by Animal View Post
    I've read and stepped through nearly every line of source in the library. You just get to know how it works.
    I've read a lot (not every line), and step through when there are issues with my understanding or implementation. Either way, Nigel is 100% correct, IMHO.

  10. #10
    Ext JS Premium Member Elijah's Avatar
    Join Date
    Nov 2009
    Location
    USA
    Posts
    382
    Vote Rating
    0
    Elijah is on a distinguished road

      0  

    Default


    Wow!

    I don't get you guys sometimes. That line of thinking to me is so off. It would be like expecting people when using JAVA libraries that it's a given that they have to unjar the libraries and decompile the source to view the content in order to look and see if a method exists before writing their own code to do something because a method may already be available but may not have documented in the API.

    Are both of you saying people should do that?

Similar Threads

  1. How to get id of record for selected row in GridPanel?
    By bbxx in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 18 Oct 2009, 5:30 PM
  2. How to display a row of data once selected
    By DantesInferno in forum Ext 1.x: Help & Discussion
    Replies: 4
    Last Post: 31 Jul 2009, 6:53 AM
  3. Retrieving data from selected row in grid
    By janixams in forum Ext 1.x: Help & Discussion
    Replies: 6
    Last Post: 10 Jun 2008, 6:19 PM
  4. How can I convert a selected row data to a javascript object
    By burgleboy711 in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 28 Dec 2006, 3:48 AM
  5. How to get the data of a selected Row?
    By next2you in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 13 Sep 2006, 12:18 PM

Thread Participants: 4