Results 1 to 6 of 6

Thread: Having issues selecting a title's in grid using getSelectionModel().getSelections()

  1. #1
    Sencha User
    Join Date
    Jun 2013
    Posts
    72
    Vote Rating
    0
      0  

    Default Having issues selecting a title's in grid using getSelectionModel().getSelections()

    I get this error message from the console when at the line colored red, not sure what the issue is:
    Uncaught TypeError: Object function (b){var a=this.indexOf(b);if(a!=-1){this.splice(a,1)}return this} has no method 'get'
    Code:
    var grid = Ext.getCmp(id);     
      var records = grid.getSelectionModel().getSelections();  
       var ids= new Array();                   
                 if(records){                        
                            for (var i in records){  
                                 var rec = records[i];                            
                                       if(rec.get('title')){  
     
                                      ids.push(rec.get('title'));                                                            
                                  }                        
                    }                                           
     }

  2. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985
    Vote Rating
    296
      0  

    Default

    In which specific version of ExtJS are you seeing this error message?

  3. #3
    Sencha User
    Join Date
    Jun 2013
    Posts
    72
    Vote Rating
    0
      0  

    Default

    version 3.3, the interesting thing is that, when i do a console.log of the selected record i.e. the line in red, I get the output printed out to the browser console, even though I am still getting this error. I have also used this technique to retrieve record field columns on a grid in the past and it works fine. Not sure what is wrong here

  4. #4
    Sencha User
    Join Date
    Jun 2013
    Posts
    72
    Vote Rating
    0
      0  

    Default

    Can anyone help with this please ?

  5. #5
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985
    Vote Rating
    296
      0  

    Default

    I think the issue is the way you are iterating through the array of selected records, which can include methods. You can try something like this:
    Code:
    var grid = Ext.getCmp(id);
    var records = grid.getSelectionModel().getSelections();
    var ids = new Array();
    if (records) {
        for (var i = 0; i < records.length; i++) {
            var rec = records[i];
            if (rec.get('title')) {
                ids.push(rec.get('title'));
            }
        }
    }

  6. #6
    Sencha User
    Join Date
    Jun 2013
    Posts
    72
    Vote Rating
    0
      0  

    Default

    yes thats the issue, dont know why the former is not working though.

    thanks

Posting Permissions

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