Dynamic Routes
Dynamic Routes
I'm trying to determine which routes to display based on a column within my datatable. How do I access that column and set that field?
Specific to my example. I want to pass in a Policy ID for a specific route and based on another column in the datatable called committed determine the routes available.
[code]
var oTable = $('#policyDataTable').dataTable({
"bServerSide": true,
"sAjaxSource": "Home/AjaxHandler",
"bProcessing": true,
"bFilter": true,
"bPaginate": true,
"sPaginationType": "full_numbers",
"aoColumns": [
{
"mData": "0", //Policy ID
"bSearchable": false,
"bSortable": false,
"mRender": function (oObj) {
return getLinks(oObj);
}
}
,{
"mdata": "1",
"name": "Committed",
}
] //close ao columns
});
function getLinks(oObj) {
var test = //Access committed field
//IF committed return these links
//return 'Cancel / Endorse'
//else return these links
//return 'Review';
}
[/code]
Any help is greatly appreciated. I will continue to mess around with it.
Specific to my example. I want to pass in a Policy ID for a specific route and based on another column in the datatable called committed determine the routes available.
[code]
var oTable = $('#policyDataTable').dataTable({
"bServerSide": true,
"sAjaxSource": "Home/AjaxHandler",
"bProcessing": true,
"bFilter": true,
"bPaginate": true,
"sPaginationType": "full_numbers",
"aoColumns": [
{
"mData": "0", //Policy ID
"bSearchable": false,
"bSortable": false,
"mRender": function (oObj) {
return getLinks(oObj);
}
}
,{
"mdata": "1",
"name": "Committed",
}
] //close ao columns
});
function getLinks(oObj) {
var test = //Access committed field
//IF committed return these links
//return 'Cancel / Endorse'
//else return these links
//return 'Review';
}
[/code]
Any help is greatly appreciated. I will continue to mess around with it.
This discussion has been closed.
Replies
[code]
var oTable = $('#policyDataTable').dataTable({
"bServerSide": true,
"sAjaxSource": "Home/AjaxHandler",
"bProcessing": true,
"bFilter": true,
"bPaginate": true,
"sPaginationType": "full_numbers",
"aoColumns": [
{
"mData": "0", //Policy ID
"bSearchable": false,
"bSortable": false,
"mRender": function (source, type, val) {
return getLinks(source, type, val);
}
}
,{
"mdata": "1",
"name": "Committed",
}
] //close ao columns
});
function getLinks(source, type, val) {
var committedFlag = val[1]; //Access committed field
if(committedFlag == "True")
return 'Cancel / Endorse'
else
return 'Review';
}
[/code]
val - contains the position and value for each element in that row. :-)
Allan