i have a list of items A and each item A have some items B. The view of the items B in A are like tabs using jQuery UI tabs. I'm loading the list of the items A in a page using a controller and each item B of the respective item A is loaded by AJAX (because they are in another table in the database and i need pass each ID of item A). If you load html content with AJAX apparently the UI tabs cannot be apply, so i put a setTimout for fix that in $(document).ready. well the problem is that if i have a lot of items A in the list, i need more time in the setTimeout, i will try put after the AJAX call (that solve some with fancybox plugin before), and works all tabs are displayed but they don't work.
Note: i have multiple groupd of tabs.
The function that i call in each item A for display the list o items B like tab.
<script type="text/javascript">
function cargar(id) {
jQuery.ajax({
url: "index.php?controller=trabajo",
data: "id="+id,
dataType: "HTML",
type: "POST",
success: function(datos) {
$('#orden-'+id).html(datos);
}
});
}
</script>
The ready function:
<script type="text/javascript">
$(document).ready(function() {
setTimeout(
function() {
var $tabs= $('.tabs')
.tabs({
collapsible: true,
selected: -1
})
.scrollabletab({
'closable':true,
});
$('#addTab').click(function(){
});
$('.ui-tabs-close').click(function(){
});
},
500 //This time must be more big if there is more content.
);
});
</script>
Thank you so much!