Forum


11:25

04/11/2008

I have an html table I'm generating with Django. I would like to then
display it as a jqGrid. However, I (being very new to javascript in general
and jQuery/jqGrid in specific) can't seem to get the TableToGrid to
fire from the $(document).ready(function). If anyone could point me
to a solution, it would be much appreciated.
Kind regards,
Robert
12:54

04/11/2008

Yes, thank you, Yamil.
It turns out I posted for help too soon, as I often do. 🙁
I have been inspecting my page with FireBug, and it looks like the proper javascript libraries are not being loaded. FireBug says it has loaded jquery.jqGrid.js, but has not loaded grid.base.js or any of the other dependencies. It is looking at media/js/js/grid.base.js, and that's exactly where the file is, but for some reason it isn't loading it. Any thoughts as to why that might be?
Kind regards,
Robert
12:55

04/11/2008

Yes, thank you, Yamil.
It turns out I posted for help too soon, as I often do. 🙁
I have been inspecting my page with FireBug, and it looks like the proper javascript libraries are not being loaded. FireBug says it has loaded jquery.jqGrid.js, but has not loaded grid.base.js or any of the other dependencies. It is looking at media/js/js/grid.base.js, and that's exactly where the file is, but for some reason it isn't loading it. Any thoughts as to why that might be?
Kind regards,
Robert
13:09

04/11/2008

Here's a simple example:
<head>
<link rel="stylesheet" type="text/css" media="screen" href="/jquery/jqGrid/themes/sand/grid.css" />
<script type="text/javascript" src="/jquery/jquery.js"></script>
<script type="text/javascript" src="/jquery/jqGrid/jquery.jqGrid.js"></script>
<script type="text/javascript">
jQuery(document).ready(function(){
tableToGrid("#distTable");
});
</script>
</head>
<body>
<table id="distTable" cellspacing="0" cellpadding="1" border="1">
<thead>
<tr>
<th>Name</th>
<th>Platform</th>
<th>Size</th>
</tr>
</thead>
<tbody>
<tr>
<td>Chatter</td>
<td>PC</td>
<td>123</td>
</tr>
<tr>
<td>Boing</td>
<td>PC</td>
<td>456</td>
</tr>
<tr>
<td>Zipper</td>
<td>Mac</td>
<td>789</td>
</tr>
<tr>
<td>PingPong</td>
<td>Mac</td>
<td>24</td>
</tr>
</tbody>
</table>
</body>
</html>
16:49

04/11/2008

Thanks, gmeader. I'll try that as soon as I get jqGrid working.
@Yamil:
My django media is at “/media/”, and it is finding the main file at “/media/js/jquery.jqGrid.js”. I have set the pathstojsfiles as “media/js/js/”, and it is attempting to find the other required files at the correct place (for example, “media/js/js/grid.base.js”, which is where the file is), but Django is reporting file not found at “media/js/js/grid.base.js/”
Notice the trailing slash on the grid.base.js import. That's almost certainly what's screwing it up, correct? I've done some Googling, but I'm not seeing many pages relating jqGrid and Django. Any idea why that slash is in there?
EDIT:
I have imported each file individually, and it does seem to work now. I'll go about trying to learn the options to get it looking a bit nicer. Thanks to all for their help.
12:05

25/08/2010

Hello Robert,
It seems that tableToGrid is not working properly.
When i load data first time it is working fine it is getting all data(76 records) correctly.But when i sorting data by clicking th part it is only get the 20 records every time.
i am using
$(document).ready(function(){
tableToGrid("#myTable");
});
thanks,
Most Users Ever Online: 715
Currently Online:
48 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66