if (semver.valid( $.trim( $cell.text() ) ) === null) {
// make invalid semver numbers obvious
$cell.addClass('red').append(' (invalid)');
}
});
});
}
}
});
});</script>
</head>
<body>
<divid="banner">
<h1>table<em>sorter</em></h1>
<h2>Semver Sorting</h2>
<h3>Flexible client-side table sorting</h3>
<ahref="index.html">Back to documentation</a>
</div>
<divid="main">
<pclass="tip">
<em>NOTE!</em>
<ul>
<li>This method does not use a parser nor a widget, it uses <code>semver.js</code> to allow the sorting of <ahref="http://semver.org/">semantic version numbers</a>.</li>
<li>But this method requires a slightly modified version of <ahref="https://github.com/isaacs/node-semver">semver.js for node</a>. All modifications are signified within the file to ease updating.</li>
<li>The modified semver.js (<ahref="../js/extras/semver-mod.js">semver-mod.js</a>) is contained in the new "extras" subfolder. Please include it if you need this specific type of sort.</li>
<li>Invalid version numbers be sorted using a basic text sort, so they will be grouped with their similar version numbers, but not sorted properly; this demo has some extra code to highlight invalid version numbers.</li>
<li>In this demo, when the semver 2.0.0 compliant version column is sorted, the order column will be in sequential order.</li>
<li>Semver example order, from semver.org:<br>1.0.0-alpha < 1.0.0-alpha.1 < 1.0.0-alpha.beta < 1.0.0-beta < 1.0.0-beta.2 < 1.0.0-beta.11 < 1.0.0-rc.1 < 1.0.0</li>