Results 1 to 1 of 1

Thread: spinning data

  1. #1
    Join Date
    Sep 2010
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default spinning data

    hello friends i have posted a thread about spiining data before 15 days but i didnt get reply from any users .But i got a amall solutionfor the query and idont know how to insert the code into my project please help me in that aspect......here im sending the shuffle code i have got
    Code:
    <html>
    <head>
    <title>How to shuffle an array in JavaScript</title>
    <script language="JavaScript">
    
    Array.prototype.shuffle = shuffle;
    
    function shuffle()
    {
    
          var tempSlot;
    
          var randomNumber;
    
    
          for(var i =0; i != this.length; i++)
          {
    
                randomNumber = Math.floor(Math.random() * this.length);
                
                tempSlot = this[i];
    
                this[i] = this[randomNumber];
    
                this[randomNumber] = tempSlot;
    
    			
    
          }
    	 
    }
    
    function shuffleNumbers()
    {
    
          var numbers = new Array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
    
          numbers.shuffle();
    
          var numbersAfterShuffle = numbers.join("<br>");
    
          document.getElementById("result").innerHTML = numbersAfterShuffle;
    
    }
    
    </script>
    </head>
    
    <body onload="javascript:shuffleNumbers();">
    
    <span id="result"></span>
    <input type="button" onclick="shuffleNumbers()");
    </body>
    </html>
    here is the code hoew to place values in the application
    Code:
    Ext.Picker = Ext.extend(Ext.Panel, {
    …………….
    …………..
    …………
    for (i = 0, ln = this.slots.length; i < ln; i++) {
    slot = this.slots[i]; // alert('i value is..... '+i);
    //alert("display field is....."+this.displayField);
    // key
    slotItem = {
    xtype: 'dataview',
    itemSelector: this.pickerItemCls,
    isSlot: true,
    flex: 1,
    listeners: {
    itemtap: this.onItemTap,
    scope: this
    },
    scroll: {
    direction: 'vertical',
    scrollbars: false,
    snapping: true,
    deceleration: 0.006,
    friction: 0.2,
    index: i,
    listeners: {
    scrollend: this.onScrollEnd,
    scope: this
    }
    },
    tpl: '<ul class="x-picker-{align}"><tpl for="."><li class="x-picker-item {cls} <tpl if="extra">x-picker-invalid</tpl>">{' + this.displayField + '}</li></tpl></ul>',
    store: new Ext.data.Store({
    model: this.model,
    data: slot.items
    })
    };
    if (this.useTitles) {
    slotItem.dockedItems = [{
    xtype: 'toolbar',
    dock: 'top',
    title: slot.title || slot.text
    }];
    }
    // alert(items.push(slotItem));
    items.push(slotItem);
    }
    }
    and for the reference of the project please visit www.urbanspoon.widget please consider it its urgent
    Last edited by jscheuer1; 10-06-2010 at 03:15 PM. Reason: format code

Bookmarks

Posting Permissions

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