Results 1 to 2 of 2

Thread: Empty an array

  1. #1
    Sencha User
    Join Date
    Jul 2012
    Posts
    235
    Vote Rating
    0
      0  

    Default Empty an array

    How to make empty to an array inside a function?

    See the highlighted parts in my code.
    Code:
    onShow : function() {
            var max = this.getPopupStoreStore().getCount();
             Ext.select('.x-mask').addListener('click', function() {
                    var yourSelection = myView.getComponent('Shipping Condition');
                    //alert(grid);
                    //alert(yourSelection);
                    var resultString = "";
                    var selected = [];
                    var selection = grid.getSelectionModel().getSelection();
                    
                    for ( var i = 0; i < selection.length; i++) {
                        console.log(selection[i].data.all);
                        selected.push(selection[i].data.all);   //How to make 'selected' variable empty before pushing values again.  Or Any other way to acieve thae same.
                    }
                    
                    console.log(selected);
                   
                    popUp.hide();
                });
    
        }

  2. #2
    Sencha User
    Join Date
    Jan 2012
    Posts
    1,376
    Answers
    347
    Vote Rating
    118
      0  

    Default

    Try this
    Code:
        for ( var i = 0; i < selection.length; i++) {
            console.log(selection[i].data.all);
            selected = []; // or Ext.Array.erase(selected, 0, seletecd.length);
            selected.push(selection[i].data.all);   //How to make 'selected' variable empty before pushing values again.  Or Any other way to acieve thae same.
        }

Tags for this Thread

Posting Permissions

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