Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Javascript / Client Side Development

Learning XML with YUI


Hi,

I'm trying to get the following code to work, but i keep getting a
"Data error." message instead of a table. Could somebody please tell
me what I'm missing?

Many thanks,
mh

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/
TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<title>Meeting Room Booking System</title>

<link type="text/css" rel="stylesheet" href="yui/build/calendar/assets/
calendar.css">
<link type="text/css" rel="stylesheet" href="styles/style.css">
</head>
<body>
    <div id="cal1Container"></div>
    <div id="schContainer"></div>

    <script type="text/javascript" src="yui/build/yahoo/yahoo.js"></
script>
    <script type="text/javascript" src="yui/build/dom/dom.js" ></
script>
    <script type="text/javascript" src="yui/build/event/event.js" ></
script>
    <script type="text/javascript" src="yui/build/calendar/
calendar.js"></script>
    <script type="text/javascript" src="yui/build/datasource/
datasource-beta-debug.js"></script>
    <script type="text/javascript" src="yui/build/datatable/datatable-
beta-debug.js"></script>
    <script type="text/javascript" src="yui/build/connection/
connection-debug.js"></script>
    <script type="text/javascript" src="yui/build/logger/logger.js"></
script>

    <script type="text/javascript">
            var myColumnHeaders = [
                {key:"time", text: "TiMe", type:"string",
sortable:true, resizeable:true},
                {key:"comments", text: "Comments", type:"string",
sortable:true, resizeable:true}
            ];
            var myColumnSet = new
YAHOO.widget.ColumnSet(myColumnHeaders);

            var myDataSource = new YAHOO.util.DataSource("./
data.xml");
            myDataSource.responseType =
YAHOO.util.DataSource.TYPE_XML;
            myDataSource.responseSchema = {
                resultNode: "bookings",
                fields: ["time", "comments"]
            };

            var oConfigs = {
                initialRequest: "index.html",
                pageCurrent: 1,
                rowsPerPage: 5,
                startRecordIndex: 1,
                rowSingleSelect: true
            };

            var myDataTable = new
YAHOO.widget.DataTable("schContainer", myColumnSet, myDataSource,
oConfigs);
        </script>
    </body>
</html>

<?xml version="1.0" encoding="UTF-8" ?>
<data>
    <bookings>
        <time>0700</time>
        <comments>foo</comments>
    </bookings>
    <bookings>
        <time>0800</time>
        <comments>bar</comments>
    </bookings>
</data>

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc