Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #1
    Sencha Premium Member
    Join Date
    Oct 2013
    Posts
    39
    Answers
    5
    Vote Rating
    2
    jocatastar is on a distinguished road

      0  

    Default Answered: How to get all selected row id in ext js grid?

    Answered: How to get all selected row id in ext js grid?


    I am using Ext.grid.panel and with that i am using check box model as a selection type.

    If i select one row or greater than one row i want to fire a event and in that event i want to get all the selected rows.

  2. Thank you for the reply farish,
    i did it this way
    Code:
    select:function(dv, record, index, eOpts ){
                   var grid = Ext.getCmp('gridid');
                   var selection= grid.getSelectionModel(); 
                   items=[];
                   for(var i=0;i < grid.store.getCount();i++){  
                      if(selection.isSelected(i)){
                          items.push(grid.store.getAt(i).data.index);
                      }
                   }
                 }

  3. #2
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    1,074
    Answers
    111
    Vote Rating
    94
    Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light

      2  

    Default


    its very simple. all you need is to add a listener for the selectionchange event of the grid:

    Code:
    listeners:
    {
      selectionchange: function(sModel, sRecords)
      {
        console.log(sRecords);  // sRecords will be an array of selected record(s) or null in case there is no selection. you can loop through it to get the id of each record.
      }
    }

  4. #3
    Sencha Premium Member
    Join Date
    Oct 2013
    Posts
    39
    Answers
    5
    Vote Rating
    2
    jocatastar is on a distinguished road

      0  

    Default


    Thank you for the reply farish,
    i did it this way
    Code:
    select:function(dv, record, index, eOpts ){
                   var grid = Ext.getCmp('gridid');
                   var selection= grid.getSelectionModel(); 
                   items=[];
                   for(var i=0;i < grid.store.getCount();i++){  
                      if(selection.isSelected(i)){
                          items.push(grid.store.getAt(i).data.index);
                      }
                   }
                 }

  5. #4
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    1,074
    Answers
    111
    Vote Rating
    94
    Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light

      0  

    Default


    instead of looping through all store records, a better way to do it is:

    Code:
    var sRecords = grid.getSelectionModel().getSelection();
    this will directly give you the selected records.

  6. #5
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    1,074
    Answers
    111
    Vote Rating
    94
    Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light

      1  

    Default


    one more thing, select only fires when a record is selected and not when one is deselected. So it might not work in every case of the user deselects some record(s). I would still recommend using selectionchange.

  7. #6
    Sencha Premium Member
    Join Date
    Oct 2013
    Posts
    39
    Answers
    5
    Vote Rating
    2
    jocatastar is on a distinguished road

      0  

    Default


    Yes farish you are right, it will not fire on unselected.

    Good catch. I will change to selectionchange

    And if i do like this

    var sRecords = grid.getSelectionModel().getSelection();

    how can i insert particular value into an array, which i am doing

    if(selection.isSelected(i)){ items.push(grid.store.getAt(i).data.index); }

  8. #7
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    1,074
    Answers
    111
    Vote Rating
    94
    Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light

      1  

    Default


    assuming that you have the selected records array in sRecords variable:

    Code:
    for(var i=0; i<sRecords.length; i++)
      items.push(sRecords[i].get('index'));
    or you can use .data.index instead of get method.

  9. #8
    Sencha Premium Member
    Join Date
    Oct 2013
    Posts
    39
    Answers
    5
    Vote Rating
    2
    jocatastar is on a distinguished road

      0  

    Default


    Nice !!!thank you very much

Thread Participants: 1