1
2 easy ways are:
-
You could have django render your javascript
-
you could set a global JS config variable in your django template and then your JS file could look for the variable.
in django template
<script type="text/javascript">
var CONFIG = {};
CONFIG.GRID_NAME = "{{ your name }}";
</script>
THen in your js file
you can check to make sure that CONFIG.GRID_NAME is set and use it appropriately.
0
Assuming you have a container div
<div id="jq-grid-container" data-my-column="{{ variable here }}"></div>
Then where you set up your jQGrid, you can just fetch your variable name with
var myColumn = $('#jq-grid-container').data('my-column');
Source:stackexchange.com