O'Reilly logo

Moodle JavaScript Cookbook by Alastair Hole

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Initializing a YUI DataSource

In this recipe, we will create a static HTML table of data in the classic way. Once we have created this table, we will go on to use it as the basis for a data source object that we can in turn pass to the YUI DataTable object.

The DataTable control can be created based on any valid YAHOO.util.DataSource. In keeping with the spirit of the concept of progressive enhancement, in this example we will use an HTML table as the data source. This allows browsers without JavaScript to view a standard HTML table of the data, while browsers with JavaScript enabled can take advantage of these enhancements.

How to do it...

We begin by creating a PHP file (datatable.php) in the cook directory. This sets up a basic Moodle environment ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required