Ciao a tutti,
ho trovato in rete un interessante script jquery che permette di aprire e chiudere il dettaglio di un record facendo click, però io vorrei aggiungere il dettaglio corrispondente all'id del DB dei dati che pervengono da un altra pagina tramite una chiamata Ajax passandogli un id, qualcuno mi può aiutare?
esmepio completo originale all'indirizzo: http://chrisrenner.com/hiddenrows/
dettaglio codice js:
<script type="text/javascript">
$(document).ready(function(){
// jQuery striped stables
// http://docs.jquery.com/Tutorials:Zeb...ping_Made_Easy
$('.dataTable tr:even').addClass("alt");
$("#items tr.itemDetail").hide();
$("#items tr.data td.clickable").click(function(){
$(this).parent().next("tr").toggle().toggleClass(' highlight');
if($(this).parent().hasClass('alt')) {
$(this).parent().next("tr").addClass('alt');
} else {
$(this).parent().next("tr").removeClass('alt');
}
$(this).parent().find(".arrow").toggleClass("up");
........QUI DOVREI INSERIRE UNA CHIAMATA AJAX CON IL PARAMETRO ID PRESENTE CHE PUNTA AD UNA PAGINA PHP CHE VISUALIZZA I DETTAGLI DEL RECORD IN UN LAYER (ajax) IN MODO TALE CHE QUANDO FACCIO CLICK SULLA FRECCIETTA IL TOOGLE ESEGUE LA CHIAMATA PASSANDO L'ID A MYSQL E VISUALIZZA IL DETTAGLIO ma non so come passarlgli l'id
DI SEGUITO C'è INDICATO L'ID ($var nell'esempio) CON IL VALORE DA PASSARE ALLA CHIAMATA Ajax
//getAjaxedContent($(this).parent().attr('id'));
// if you ajax what's in the <span> in the hidden row, you'd want to fire your ajax function //here'
$('#items tr.data td').css('border-collapse', 'collapse');
});
});
</script>
<?php
select ETC......
while(list($key,$value) = each($messaggi))
{
$msgviewletti .= " <tr valign=\"top\" id=" . $var . " class=\"data\">
<td class=\"clickable\" align=\"center\"><div class=\"arrow\" title=\"show/hide item summary\"></div></td>
<td class=\"clickable\">".$value->date."</td>
<td class=\"clickable\">".$value->subject."</td>
<td class=\"clickable\">From ".$value->from."</td>
</tr>
<tr class=\"itemDetail\" id=\"expand_" . $var . "\">
<td colspan=\"8\"><span id=\"tip$var\">This could be ajaxed content loaded in here....</span></td>
</tr>
}
?>
ed infine l'HTML
<table class="dataTable" id="items" align="center">
<thead>
<tr><th>Dettaglio email</th>
<th>Data</th>
<th>Oggetto</th>
<th>From</th>
</tr>
</thead>
<tbody>
<?php echo $msgviewletti; ?>
</tbody>
</table>
................................... come faccio a visualizzare il dettaglio Ajax sull 'layer <span id=\"tip$var\">This could be ajaxed content loaded in here....</span>
Grazie