Datatable is very slow with ASP Button
Datatable is very slow with ASP Button
Hi,
I've added Datatable to my ASP Gridview that use asp:ObjectDataSource to get datas.
Everything working fine to get the datas, also large amount (1000+).
But with Datatable it take to much time to load 1000+ rows.
I tested to find why it take many time and I found thats because I have asp:ImageButton in my rows. So, I tried to replace them with asp Image and with asp Button to check which par cause the issue and there is no problem with Image but it take many time with the buttons.
The Datatable initialisation : (ImageButton columns are 7,8,9,10)
$('.gvv').dataTable({
"scrollY": "43vh",
"scrollCollapse": true,
"lengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, "All"]],
"pageLength": 50,
"scrollX": true,
"sScrollXInner": "100%",
"language": {
"search": "",
"infoFiltered": "(filtré sur _MAX_ lignes)",
"lengthMenu": "Afficher : _MENU_ ",
"info": " _TOTAL_ ligne(s)",
"zeroRecords": "Aucune donnée n’a été trouvée",
"infoEmpty": "0 lignes",
"paginate": {
"first": " ",
"last": " ",
"next": " ",
"previous": " "
}
},
"pagingType": "simple_numbers",
dom: 'Bfrtip',
buttons: [
{
extend: 'excel',
text: 'Export excel',
filename: 'MesCommandes',
title: 'Mes Commandes',
exportOptions: {
modifier: {
page: 'current'
}
}
}
],
"orderClasses": false,
columnDefs: [
{ "orderable": false, "targets": [0, 7, 8, 9, 10, 12] }
,
//date-fields
{
"orderable": true,
"targets": 1,
"type": 'date-eu'
}
,
//money-fields
{
"orderable": true,
"targets": 11,
"type": 'currency'
}
,
{
"targets": [12],
"className": "hide_column"
}
],
"order": [[1, "desc"]]
});
Did you have an idea of a solution on that problem ?
Thank you.
Answers
Hi again, I found a solution.
I just replaced my asp:ImageButton with an HTML link and I applied the image in CSS :
<a id="btnFact" runat="server" class="myButtonClass" onserverclick="btnFact_Click"></a>
Tanks.