Fixed FELIX-2257 /Bundle sort order is not stored in a cookie anymore/
https://issues.apache.org/jira/browse/FELIX-2257

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@933940 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/webconsole/src/main/resources/res/ui/bundles.js b/webconsole/src/main/resources/res/ui/bundles.js
index a36c5c1..6cb010e 100644
--- a/webconsole/src/main/resources/res/ui/bundles.js
+++ b/webconsole/src/main/resources/res/ui/bundles.js
@@ -40,7 +40,10 @@
         showDetails(id);
     }
     initStaticWidgets();
-	
+
+	var cv = $.cookies.get("webconsolebundlelist");
+	if (cv) bundlesTable.trigger('sorton', [cv]);
+
 	// show dialog on error
 	if (eventData.error) bundleOpError.dialog('open').find('pre').text(eventData.error)
 }
@@ -244,18 +247,15 @@
 	});
 
 	// check for cookie
-	var cv = $.cookies.get("webconsolebundlelist");
-	var lo = (cv ? cv.split(",") : [1,0]);
 	bundlesTable = $("#plugin_table").tablesorter({
 		headers: {
 			0: { sorter:"digit" },
 			5: { sorter: false }
 		},
 		textExtraction:mixedLinksExtraction,
-		sortList: cv ? [lo] : false
 	}).bind("sortEnd", function() {
-		bundlesTable.eq(0).attr("config");
-		$.cookies.set("webconsolebundlelist", bundlesTable.sortList.toString());
+		var t = bundlesTable.eq(0).attr("config");
+		if (t.sortList) $.cookies.set("webconsolebundlelist", t.sortList);
 	});
 	bundlesBody     = bundlesTable.find('tbody');
 	bundlesTemplate = bundlesBody.find('tr').clone();