Hi!
I am using a list to show some data, imported from a JSON like this
[code][
{
“id”: 1,
“name”: “Petronor”,
“lat”: “41.598”,
“lon”: “1.68”,
“address”: “AP AP-68, 36”,
“poblacion”: “Altube”,
“gasolina95”: “1,5”,
“gasolina97”: “1,58”,
“gasolina98”: “1,63”,
“gasoleoA”: “1,2”,
“provincia”:“02”,
“distancia”:“7,23”
},
{
"id": 2,
"name": "Repsol",
"lat": "41.798",
"lon": "1.98",
"address": "AG AP-68, 36",
"poblacion": "Altube",
"gasolina95": "1,4",
"gasolina97": "1,6",
"gasolina98": "1,9",
"biodiesel": "1,3",
"provincia":"02",
"distancia":"10,23"
}
][/code]
and I want to display dinamically all the entries that have a concrete field, for example, i want a row for every entry that have biodiesel field, only the first in this case
I use template function for the list, like this
[code]template: function (obj) {
if(eval(precio_gasolina)!=undefined){
alert(eval(precio_gasolina));
var html = ‘
’ + ‘’
if (obj.name == idioma.cargarmas) {
html += '<tr class="fondo_tr_cargar_mas"><td class="fondo_td_hueco"></td><td style="width:25px"><img src="images/cargar_mas.png"></td><td class="fondo_td_hueco_2"></td><td class="fondo_td_cargar_mas">' + obj.name + ' . . . ' + '</td></tr>'
} else {
html += '<tr><td width="20%" rowspan="3" align="middle"><img src="images/iconos_gasolineras/30x35/'+ obj.name+'.bmp" alt="no icon"></img></td><td class="pruebaneg" width="60%">' + obj.name + '</td><td width="30%" rowspan="3" align="middle">'+ eval(precio_gasolina) +' €/L</td></tr>'
//html += '<tr><td class="pruebaneg">' + obj.name + '</td></tr>'
html += '<tr><td style="font-size:80%;">' + obj.address + '</td></tr>'
html += '<tr><td style="font-size:80%;">' + obj.poblacion + ' - ' + getNameProvincia(obj.provincia) + '</td></tr>'
}
html += '</tbody>' + '</table>';
return html;
}else{
html = '<div style="display:hidden;"></div>'
return html;
}
},[/code]
but it displays a empty row, what should I put in the else so they dont draw a row??
Thanks!