Dynamically loading data and Tabs - a real challenge
Hello All,
I have a rather peculiar question thats driving me nuts.
I have a list of products in a table, and would like to have tabs to
edit various aspects of the products when a product's table row is
clicked. The list is loaded dynamically when a use clicks on a
particular category, also loaded dynamically in another div.
the product table is being loaded into a div which isnt one of the
tabs div's, but is located under them. Content is loaded into this div
from a php script and jquery/ajax.
But sometimes a table wont be loaded because the category has no
products.
I would like to disable two or more tabs IF the content loaded into
the div DOES NOT contain a table with id table#product list. IF it
DOES, then enable those tabs.
What would be the best way to achieve this? It almost like I need to
listen for the content changing.. or create a callback from the ajaz
loading.
Heres the script for the content loading:
function pre_view_category(cat_id) {
$.ajax({
type: "GET",
url: "{$base_url}",
data: "P=list_category_products&cat_id="+cat_id,
dataType: "html",
success:
function(data){
$('#product_pane').html(data);
}
})
}
And heres the ready function
$(document).ready(function(){
$('#manager > ul').tabs(); //set up the tabs
});