この関数は、列を並べ替え可能にするために作成しました。特定の注文番号に関連付けられているdivを再配置したいと思います。chromeとfirefoxで正常に動作しますが、何らかの理由でIE8では、関数の最後に、再配置されたすべてのコンテンツを#current_orders_content2
divに追加する代わりに、すべてのコンテンツが単に消えます。関数はJSlintで(jsfiddleを介して)チェックアウトします。興味深いのは、最後に(IEコンソールを介して)すべての値を見ると、すべてが正常に見えることです。値は、私が期待する値です。append()
失敗したようです。だから私はでテストしましたが.html()
、appendTo
それでも喜びはありません。html文字列を渡すと機能しますが、これらのjqueryオブジェクトで失敗します。
なぜ、またはどのようにそれを機能させることができるかについてのアイデアはありますか?
ありがとう!
$('.sortable').click(function () {
"use strict";
if ($(this).hasClass('sortable_numeric')) {
/*
*function sets ascending/descending classes
*for formatting, placement of arrow_up.png, arrow_down.png
*returns the sort order to be used below "asc" or "desc"
*/
var sort_order = sort_class_distribution($(this));
var current_val = "";
var order_number = "";
/*
*determine what column is being sorted
*remove the "_header" text from the id to
*get this information
*/
var sort_column = this.id;
sort_column = sort_column.replace("header_", "");
/*
*append "_div" to the end of the string to get
*the class of the divs we are sorting by
*/
sort_column += "_div";
var valuesArr = [];
$('.' + sort_column).each(function () {
var current_val = $.trim($(this).text());
current_val = parseInt(current_val, 10);
valuesArr.push(current_val);
});
var sorted = [];
if (sort_order == "asc") {
sorted = valuesArr.slice(0).sort(sortA);
} else if (sort_order == "desc") {
sorted = valuesArr.slice(0).sort(sortD);
}
/*
* for each item in this array, get the parent div
* with the class order_and_lines_container_div.
*
* push it into an array of its own to to put back
* onto the page in the order of the sorted array
*/
var containerArr = [];
var current_container = "";
var c = 0;
for ( c = 0; c <= sorted.length; c++ ) {
current_container = $('#order_container_' + sorted[c]);
containerArr.push(current_container);
}
$('#currentOrdersContent2').html('');
for ( c = 0; c <= sorted.length; c++ ) {
$('#currentOrdersContent2').append(containerArr[c]);
}
}
});