JQuery DataTables with ASP.Net MVC 4 with Custom Buttons
JQuery DataTables with ASP.Net MVC 4 with Custom Buttons

I want to use Jquery Datatables at my MVC 4 project for grid based operations and general listing.
After some search i found JQuery Datatables and i decided to use it. At first everythings seems good but when i came to add custom row buttons for Details, Edit and Delete problems started.
In conventional way adding a button to a row is just adding code into to the relevant ` `
But datatables is quite different, i got below sample code from here http://stackoverflow.com/a/9774102/423699
[code]
"aoColumnDefs" : [
{
"aTargets": [0],
"fnCreatedCell" : function(nTd, sData, oData, iRow, iCol){
var b = $('edit');
b.button();
b.on('click',function(){
document.location.href = oData[0];
return false;
});
$(nTd).empty();
$(nTd).prepend(b);
}
},
[/code]
As previously mentions we have three buttons and some screens have optional buttons and they appear after some if-else conditions.
Also until datatables we were using Html.ActionLink and css things to show buttons; but after using datatables it becomes very hard to put buttons.
So i think may be we do something wrong and you can help us to figure out.
After some search i found JQuery Datatables and i decided to use it. At first everythings seems good but when i came to add custom row buttons for Details, Edit and Delete problems started.
In conventional way adding a button to a row is just adding code into to the relevant ` `
But datatables is quite different, i got below sample code from here http://stackoverflow.com/a/9774102/423699
[code]
"aoColumnDefs" : [
{
"aTargets": [0],
"fnCreatedCell" : function(nTd, sData, oData, iRow, iCol){
var b = $('edit');
b.button();
b.on('click',function(){
document.location.href = oData[0];
return false;
});
$(nTd).empty();
$(nTd).prepend(b);
}
},
[/code]
As previously mentions we have three buttons and some screens have optional buttons and they appear after some if-else conditions.
Also until datatables we were using Html.ActionLink and css things to show buttons; but after using datatables it becomes very hard to put buttons.
So i think may be we do something wrong and you can help us to figure out.
This discussion has been closed.