DataStore - Why yhis does not work ?


#1

I Have this code:

function check_data(){
	alert(data.item(0).id);


	}
	
	   var data = new dhtmlXDataStore({
			url:"../orm/get_servicos.php",
			datatype:"json",
			 ready:check_data, 
	   });

But, the alert There is nothing in return.

The json returned is as follows (from url:"…/orm/get_servicos.php"):
[{“id”:“4”,“servico_id”:“4”,“descricao”:“PENTEADO”,“repasse”:“3”,“valor”:“150.35”,“excluido”:“N”,“cor”:“RED”},{“id”:“7”,“servico_id”:“7”,“descricao”:“MAKE”,“repasse”:“4”,“valor”:“100”,“excluido”:“N”,“cor”:“YELLOW”}]


#2

alert(data.item(0).id);
the parameter of the item method should be the id of the item:
docs.dhtmlx.com/api__datastore_item.html

you need to use one of the valid ids of your data:
alert(data.item(4).id);
alert(data.item(7).id);