Selecting a datatable from a list of datatables dynamically
Selecting a datatable from a list of datatables dynamically
Hi,
I've a web page with 3-4 datatables and each datatable has been defined separately inside $(document).ready(). All the data tables have the same ajax source and are populated on page load. Now, I have 4 option buttons with each pointing to one datatable. When an option button is clicked, the corresponding datataable must be populated with data from a new ajax source. How do I select a datatable,clear its contents and load with ajax data from the new ajax source ?
Thanks,
Ray
I've a web page with 3-4 datatables and each datatable has been defined separately inside $(document).ready(). All the data tables have the same ajax source and are populated on page load. Now, I have 4 option buttons with each pointing to one datatable. When an option button is clicked, the corresponding datataable must be populated with data from a new ajax source. How do I select a datatable,clear its contents and load with ajax data from the new ajax source ?
Thanks,
Ray
This discussion has been closed.
Replies
Datatable1
Datatable1
Datatable1
$(document).ready(function(){
//Definition of data tables
datatable_1 = $('html_table_1').datatable({
// set attributes, data table fns etc
// load data from ajaxsource1
});
datatable_1 = $('html_table_1').datatable({
// set attributes, data table fns etc
});
datatable_1 = $('html_table_1').datatable({
// set attributes, data table fns etc
});
function fnFireAjaxForRadioButton(optionButtonName) {
name = "";
if(name == "datatable1") {
datatable_1 = null;
}else if(name == "datatable2") {
datatable_1 = null;
}else if(name == "datatable3") {
datatable_1 = null;
}
// all option buttons linked to a common ajax call.
// fire ajax call . load data from ajaxsource2
}
});
Is the function fnFireAjaxForRadioButton correctly implemented such that the correct data table is chosen and new data loaded in it ?
Thanks,
Ray