how to make sAjaxSource call Dynamic in DT? challenging one
how to make sAjaxSource call Dynamic in DT? challenging one
sunildon
Posts: 40Questions: 7Answers: 0
Hi Allan & everyone
I am trying to apply a filter i.e DROP DOWN LIST on top of datatable .
I have 3 list items in dropdown i.e my leads,all leads,dead leads . (i binded this static )
Well on my page load The dropdownlist with My leads will be selected and data will be available according to the option choosen in dropdown list . Further if i change anything in dropdown i want my table data to change i.e need to make a call to controller action menthod to fecth data based on dropdonn selection .
I am able to load data to datatable but i have no idea how to send a call back to controller to get data based on dropdown selection before datatable fills its data via ajaxsource?
[quote]I can deal with code at controller i just need a snippet to pass the selected value to controller action method [/quote]
My code :
[code]
$('#myDataTable').dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "AjaxHandler", //On my initial load this makes a call to AJAXHANDLER CONTROLLER ACTION METHOD and then datatable will be filled with data .. I WANT TO MAKE THIS DYNAMIC based on dropdown ?
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"aoColumns": [
{
"sName": "Lead_Id"
},
{ "sName": "LeadName" },
{ "sName": "ContactName" },
{ "sName": "CompanyName" },
{ "sName": "AssignTo" },
{ "sName": "LeadStatus" }
]
}); [/code]
Regards
I am trying to apply a filter i.e DROP DOWN LIST on top of datatable .
I have 3 list items in dropdown i.e my leads,all leads,dead leads . (i binded this static )
Well on my page load The dropdownlist with My leads will be selected and data will be available according to the option choosen in dropdown list . Further if i change anything in dropdown i want my table data to change i.e need to make a call to controller action menthod to fecth data based on dropdonn selection .
I am able to load data to datatable but i have no idea how to send a call back to controller to get data based on dropdown selection before datatable fills its data via ajaxsource?
[quote]I can deal with code at controller i just need a snippet to pass the selected value to controller action method [/quote]
My code :
[code]
$('#myDataTable').dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "AjaxHandler", //On my initial load this makes a call to AJAXHANDLER CONTROLLER ACTION METHOD and then datatable will be filled with data .. I WANT TO MAKE THIS DYNAMIC based on dropdown ?
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"aoColumns": [
{
"sName": "Lead_Id"
},
{ "sName": "LeadName" },
{ "sName": "ContactName" },
{ "sName": "CompanyName" },
{ "sName": "AssignTo" },
{ "sName": "LeadStatus" }
]
}); [/code]
Regards
This discussion has been closed.
Replies
If you are using 1.10, use ajax.url() - http://next.datatables.net/reference/api/ajax.url()
Allan
I am not using either versions sadly . I have compatibility issues lately . when i try to use advanced versions of data-tables i face issue on jquery version ? browser not supported some times .
Well i am keen on going a ahead with advanced version's . Would you please mention me data-tables compatibility with jquery.js file version and may bootstrap,knockout too . . I will be using IE10 present + mozilla+chrome .
My version of DataTable is 1.7 and jquery.js is 1.4.4 // sadly i can only move a ahead with this combination which works for me at present where remaining all throws me script exceptions . So any suggestions on this front so i can use above mentioned link to my advantages :)
Thank you allan
Regards
Sunil G
1.7 is not supported at all anymore, but you could probably hack fnReloadAjax to work with it if you wanted to.
Allan
I hope please give you best combination where everything should work near best :)
Regards
Allan