PDA

View Full Version : spinning data



thimmappa449
10-06-2010, 06:42 AM
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


<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


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