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
My first grid
16/12/2009
14:24
Avatar
paulojsp
Member
Members
Forum Posts: 6
Member Since:
16/12/2009
sp_UserOfflineSmall Offline

hi,

i'm trying to use for the first time the jQuery Grid, but i'm stuck in the same problem over two days…

error:

jquery.js:641 Uncaught TypeError: Cannot read property 'nodeType' of null

My code using the table from the manual example:

<html> <head>

        <title>jqGrid Demo</title>

        <link rel=”stylesheet” type=”text/css” media=”screen” href=”css/ui-lightness/jquery-ui-1.7.1.custom.css” />

<link rel=”stylesheet” type=”text/css” media=”screen” href=”css/ui.jqgrid.css” />

<script src=”js/jquery-1.3.2.min.js” type=”text/javascript”></script>

<script src=”js/jquery.js” type=”text/javascript”></script>

<script src=”js/i18n/grid.locale-en.js” type=”text/javascript”></script>

<script src=”js/jquery.jqGrid.min.js” type=”text/javascript”></script>

<script type=”text/javascript”>

jQuery(document).ready(function(){

jQuery(”#list”).jqGrid({ url:'example1.php',

              datatype: 'xml', mtype: 'GET',

           colNames:['Inv No','Date', 'Amount','Tax','Total','Notes'],

                    colModel :[ {name:'invid', index:'invid', width:55},

                        {name:'invdate', index:'invdate', width:90},

                       {name:'amount', index:'amount', width:80, align:'right'},

                        {name:'tax', index:'tax', width:80, align:'right'},

                        {name:'total', index:'total', width:80, align:'right'},

                        {name:'note', index:'note', width:150, sortable:false} ],

                    pager: jQuery('#pager'), rowNum:10, rowList:[10,20,30],

                    sortname: 'invid', sortorder: 'note', viewrecords: true,

                    caption: 'My first grid' }); });

        </script> </head> <body> <table id=”list” class=”scroll”></table>

            <div id=”pager” class=”scroll” style=”text-align:center;”></div>

       </body> </html>

php output: 

<meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″>

<rows><page>1</page><total>1</total><records>4</records><row id='1'><cell>1</cell><cell>2009-12-16</cell><cell>3.00</cell><cell>2.00</cell><cell>3.00</cell><cell><![CDATA[dsfsdf]]></cell></row><row id='2'><cell>2</cell><cell>2009-12-16</cell><cell>3.00</cell><cell>2.00</cell><cell>3.00</cell><cell><![CDATA[dsfsdf]]></cell></row><row id='3'><cell>3</cell><cell>2009-12-16</cell><cell>3.00</cell><cell>2.00</cell><cell>3.00</cell><cell><![CDATA[dsfsgfhfhfgh]]></cell></row><row id='4'><cell>4</cell><cell>2009-12-16</cell><cell>5.00</cell><cell>9.00</cell><cell>3.00</cell><cell><![CDATA[dsfsgfhfhfgh]]></cell></row></rows>

php file:

<?php
include (”startBD.php”);
$page = $_GET['page'];
$limit = $_GET['rows'];
$sidx = $_GET['sidx'];
$sord = $_GET['sord'];
if(!$sidx) $sidx =1;
$result = mysql_query(”SELECT COUNT(*) AS count FROM invheader”);
$row = mysql_fetch_array($result,MYSQL_ASSOC);
$count = $row['count'];
if( $count > 0 ) {
    $total_pages = ceil($count/$limit);
} else {
    $total_pages = 0;
}
if ($page > $total_pages) $page=$total_pages;
$start = $limit*$page – $limit;
if($start <0) $start = 0; // the actual query for the grid data
$SQL = “SELECT invid, invdate, amount, tax,total, note FROM invheader ORDER BY $sidx;”;
$result = mysql_query( $SQL ) or die(”Couldn't execute query.”.mysql_error());
if ( stristr($_SERVER["HTTP_ACCEPT"],”application/xhtml+xml”) ) {
    header(”Content-type: text/xml;charset=utf-8″);
}
else {
    header(”Content-type: text/xml;charset=utf-8″);
}
echo “<?xml version='1.0' encoding='utf-8'?>”;
echo “<rows>”;
echo “<page>”.$page.”</page>”;
echo “<total>”.$total_pages.”</total>”;
echo “<records>”.$count.”</records>”; // be sure to put text data in CDATA
while($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
    echo “<row id='”. $row['invid'].”'>”;
    echo “<cell>”. $row['invid'].”</cell>”;
    echo “<cell>”. $row['invdate'].”</cell>”;
    echo “<cell>”. $row['amount'].”</cell>”;
    echo “<cell>”. $row['tax'].”</cell>”;
    echo “<cell>”. $row['total'].”</cell>”;
    echo “<cell><![CDATA[". $row['note'].”]]></cell>”;
    echo “</row>”;
} echo

“</rows>”; ?>

i can use some help!

thanks ^^

16/12/2009
21:43
Avatar
paulojsp
Member
Members
Forum Posts: 6
Member Since:
16/12/2009
sp_UserOfflineSmall Offline

I found the problem (beginner's mistake).

sorry the previous post.

thanks anyway

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
51 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