Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
TableToGrid help
04/11/2008
11:25
Avatar
Robert
Member
Members
Forum Posts: 8
Member Since:
04/11/2008
sp_UserOfflineSmall Offline

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

04/11/2008
12:31
Avatar
YamilBracho
Member
Members
Forum Posts: 124
Member Since:
08/09/2008
sp_UserOfflineSmall Offline

According the docs, you only need to give your HTML table an id or a "selector (a class attribute), say:

<table class="mytable"> (or <table id="mytable">)

I think you have to write :

$(document).ready( function() {
tableToGrid("#mytable");
});

HTH

04/11/2008
12:54
Avatar
Robert
Member
Members
Forum Posts: 8
Member Since:
04/11/2008
sp_UserOfflineSmall Offline

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

04/11/2008
12:55
Avatar
Robert
Member
Members
Forum Posts: 8
Member Since:
04/11/2008
sp_UserOfflineSmall Offline

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

04/11/2008
13:09
Avatar
gmeader
Member
Members
Forum Posts: 4
Member Since:
04/11/2008
sp_UserOfflineSmall Offline

Here's a simple example:

<HTML>

<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>

04/11/2008
13:28
Avatar
YamilBracho
Member
Members
Forum Posts: 124
Member Since:
08/09/2008
sp_UserOfflineSmall Offline

Robert, check the pathtojsfiles var in your jQuery.jqGrid.js file

04/11/2008
16:49
Avatar
Robert
Member
Members
Forum Posts: 8
Member Since:
04/11/2008
sp_UserOfflineSmall Offline

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.

26/08/2010
12:05
Avatar
chiragvels
Member
Members
Forum Posts: 4
Member Since:
25/08/2010
sp_UserOfflineSmall Offline

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,

Forum Timezone: Europe/Sofia

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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information