1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    75
    Vote Rating
    1
    owenho is on a distinguished road

      0  

    Default get the id of selections line in grid ??

    get the id of selections line in grid ??


    Hi all,
    i have a question if possible,
    i add in my grid the option:
    Code:
    multiselect:true,
    when i select for exemple 2 or 3 lines,how can i get all her id.
    I tried that but it just gives me the id of a single line:
    Code:
    var selection = grid.getSelectionModel().getSelection()[0];
     	var ref_fonc_o=''+selection.get('id');
    help please,

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,990
    Vote Rating
    455
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    In your code, you are asking for single selection.

    Try:

    Code:
    var users = [];
    for (var i = 0, rec; rec = selRows[i]; i++){
        users.push({ id: selRows[i].data.id_user });
    }
    // ajax call to delete all id instead of multiple calls to store.remove
    Ext.Ajax.request({
        params  : {
            ids: Ext.encode(users) // list of users
        },
    });
    Scott.

  3. #3
    Sencha User
    Join Date
    Mar 2012
    Posts
    75
    Vote Rating
    1
    owenho is on a distinguished road

      0  

    Default


    Thanks Scottmartin,

    i used my code but in boucle like this :
    Code:
    var selection = grid.getSelectionModel().getSelection();			var ids='';
    		for(var i=0;i<selection.length;i++){
    			ids+=selection[i].get('id')+',';
    							}
    then i get my ids like this,
    Code:
    idselected1,idselected2,..
    Thanks for reply Scott

    Badr,

Thread Participants: 1