I have the following in a file:
<script type="text/javascript">
function refreshGridSetup() {
$.extend($.fn.dataTableExt.oStdClasses, {
sWrapper: 'no-margin last-child'
});
</script>
Then after this I have:
<script src="/Scripts/admin/jquery.dataTables.js"></script>
Am I correct in saying that the first code is a prototype that extends dataTables?
Will it be okay to have this before the code that defines dataTables?
No, because
$.fn.dataTableExt.oStdClasseswon’t exist yet. You’ll have to include the dataTables script first, as the jQuery prototype won’t be extended until that has run.By running your code before dataTables has created it’s namespaces, you will get an error along the lines of:
Edit: Sorry, I didn’t notice the
refreshGridSetupfunction (I guess the missing closing curly brace is just a typo in the question?). If you don’t call that function until after dataTables has been included, you won’t have any problems.