O'Reilly logo

Programming Atlas by Christian Wenz

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

Chapter 9. Using Server Data

The Atlas features described in previous chapters save a lot of work, but there is still more to come with regard to working with data. So far you have seen how JavaScript can be used to change the contents of a page based on data returned from the server via the XMLHttpRequest object, and you’ve seen how Atlas controls make data binding easy.

In this chapter, you’ll learn how to use Atlas to connect to databases and to bind data from these sources to page elements. This functionality lets you bind complex data as well, and you are not limited to simple, static controls like text fields. With Atlas, you can use tables and HTML lists to display data and even create your own custom data source.

In Chapter 5, you have already seen how to bind data to Atlas client controls, but back then, there was no server involved. This chapter shows how to use data from the server. There, you need to write a web service that retrieves data from the data source and returns it. You can then use the client Atlas controls and xml-script markup to display that data in HTML.

Using a ListView Control

The best way to display data in Atlas is using the ListView control (in xml-script, the <listView> element). This control can iterate through a list so that the user can view the result—that’s where the name of the control comes from.

Within a <listView> xml-script element, you can define two display templates:

<layoutTemplate>

To specify the layout and appearance of the data ...

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