JQuery Tablesorter keine Funktion

Ich bin Parsen einer XML-Datei in eine Tabelle und möchte die jquery-tablesorter. Ich habe viele Dinge versucht, von denen keines gearbeitet haben. Ich war Parsen der XML-Datei zuerst über AJAX und rufen dann tablesorter auf meinem Tisch. Die Art und Weise habe ich meinen code jetzt, ich rufe den tablesorter auf meinem Tisch, läuft AJAX, und dann die Aktualisierung der Tabelle mit $("#table).trigger("update"). Ich bin immer diese Fehlermeldung, egal ob ich es bei der ersten Art oder der zweiten Art: "$(#table).tablesorter() ist keine Funktion". Irgendwelche Ideen? Code ist unten aufgeführt für JS und HTML.

HTML:

<html>
<head>
    <title>Read XML</title>
    <script type="text/javascript" src="jquery-1.7.1.js"></script>
    <script type="text/javascript" src="jquery-latest.js"</script>
    <script type="text/javascript" src="jquery.tablesorter.js"</script>
    <script type="text/javascript" src="custom.js"></script>
</head>
<body>
    <table id="table" border="1">
        <thead>
            <tr>
                <th>Item #</th>
                <th>Shape</th>
                <th>Weight</th>
                <th>Color</th>
                <th>Clarity</th>
                <th>Price($)</th>
            </tr>
        </thead>
        <tbody>
        </tbody>
    </table>
</body>
</html>

JS:

$(document).ready(function() {
$("#table").tablesorter();
 $.ajax({
     type: "GET",
     url: "tutorial.xml",
     dataType: "xml",
     success: parseXml
 });
$("#table").trigger("update");
});

function parseXml(xml)
{
    $(xml).find("diamond").each(function()
    {
        $("#table tbody").after("<tr><td>" + $(this).find("id").text() + 
        "</td><td>" + $(this).find("shape").text() + "</td><td>" + $(this).find("weight").text() + 
        "</td><td>" + $(this).find("color").text() + "</td><td>" + $(this).find("clarity").text() + 
        "</td><td>" + $(this).find("price").text() + "</td></tr>");
    });
}
Warum sind Sie wie jQuery zweimal?
ich sah es in einem Beispiel, und es ist auch aufgeführt auf der tablesorter-Webseite.

InformationsquelleAutor Brandon | 2012-01-18

Schreibe einen Kommentar