Yakup K
asked on
Jquery append method issue on the IE browser
var nestedtablesettings = {
"iDisplayLength": 20,
"bLengthChange": false,
"bFilter": true,
"bSort": true,
"bInfo": false,
"drawCallback" : function() {
var appendDownloadLink = $("table table td .dataTables_filter");
appendDownloadLink.each(function(i, e) {
var label = $('label', e);
$(e).html('<a class="export-circuits" href >Export circuits</a>').append(label);
$(".export-circuits").on("click", function(e){
circuit = $(this).closest('tr').prev('tr').children('td').eq(1).text();
hpath = "exportCircuits?organisationID="+getbusinessID+"&interfaceName="+circuit;
$(this).attr("href", hpath);
});
});
}
};
I am trying to add an export link on the nested datatable. When I try to see my result on Chrome and Firefox, it is working perfectly.
The result on chrome and Firefox
<div id="nested-datatable-covertab_0_row_0_tab_0_row_0_tab_0_filter" class="dataTables_filter"><a class="export-circuits" href="">Export circuits</a><label>Search:<input type="search" class="" placeholder="" aria-controls="nested-datatable-covertab_0_row_0_tab_0_row_0_tab_0"></label></div>
On the IE, it removed the data from label elements.
<div id="nested-datatable-covertab_0_row_0_tab_0_row_0_tab_0_filter" class="dataTables_filter"><a class="export-circuits" href="">Export circuits</a>
<label></label>
</div>
From my research, IE has got some issue with jquery append method.
Any helps would be highly appreciated.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi LeaKim,
That show the search box on the IE, but it removes the functionality of the search.
With this implementation search does not work on any browsers now.
Do you have any ideas ?
That show the search box on the IE, but it removes the functionality of the search.
With this implementation search does not work on any browsers now.
Do you have any ideas ?
what about :
var nestedtablesettings = {
"iDisplayLength": 20,
"bLengthChange": false,
"bFilter": true,
"bSort": true,
"bInfo": false,
"drawCallback" : function() {
$("table table td .dataTables_filter").prepend('<a class="export-circuits" href >Export circuits</a>');
$(".export-circuits").on("click", function(e){
circuit = $(this).closest('tr').prev('tr').children('td').eq(1).text();
hpath = "exportCircuits?organisationID="+getbusinessID+"&interfaceName="+circuit;
$(this).attr("href", hpath);
});
}
};
ASKER
Thanks for your help again. This solution is creating my previous issue again. When you append element like this, if you you click any links on the last level table, it duplicated the links because of datatable plugins.
That's why we tried like the following;
But, this solution removes the search box from the label.
<div id="nested-datatable-covertab_0_row_0_tab_0_row_0_tab_0_filter" class="dataTables_filter"><a class="export-circuits" href="">Export circuits</a><a class="export-circuits" href="">Export circuits</a><a class="export-circuits" href="">Export circuits</a><a class="export-circuits" href="">Export circuits</a><label>Search:<input type="search" class="" placeholder="" aria-controls="nested-datatable-covertab_0_row_0_tab_0_row_0_tab_0"></label></div>
That's why we tried like the following;
var label = $('label', e);
$(e).html('<a class="export-circuits" href >Export circuits</a>').append(label);
But, this solution removes the search box from the label.
it duplicated the links because of datatable plugins.
do you have a link or can reproduce that on jsfiddle ? I do'nt get it
ASKER
jsfiddle
Thanks a lot for your help.
Please see the link on the jsfiddle. When you click on the inner table header, it duplicates the links.
Thanks a lot for your help.
Please see the link on the jsfiddle. When you click on the inner table header, it duplicates the links.
ASKER