Damn sometimes… Sometimes we have bugs that seem just impossible. Well I’ve just had one, I solved I just can’t resist posting it here. Guys I have to tell you it’s the most stupid bug I’ve sold, I laugh so much when I understood what happend. Ahhh life’s funny sometimes 😉

Here it is.

I’m querying a JsonRestStore that sends back this data :


Well I removed the content of the data but that’s of no importance. Note that I had about 25 records sent from the JsonRestStore that looked pretty much the same except one field : item_type was for item 1 “lunches” and for all the rest “opportunities”.

Then my code, inside a dojo widget I’m fetching the JsonRestStore and getting the items. Except I want to order items using the field item_type.

// Fetch the objects

query: {object:"Task"},
sort: sortKeys, // Order by... date DESC
onComplete: dojo.hitch(this, function(items,request){


// Now format each element
for (var i = 0; i < items.length; i++){

var item=items[i];


lunches += '

//console.log(item.item_type + item.id);
else if (item.item_type="opportunities"){

lunches += '


// Add titles to the elements
if(lunches !=""){

lunches = "


" + lunches ;
if(opportunities !=""){

opportunities = "


" + opportunities ;

this.TaskList.innerHTML = lunches + opportunities ;


Guess what happend… All my items went on the lunches category. But WHY WHY WHY ???
You’ll find out I’m sure, and laugh a lot, hopefully 😉