The request.xhr? method will return true during an XmlHttpRequest (XHR)
request, and in that case, the layout is disabled.
The second format is text. This is the format that Open Flash Chart uses to store its
data. The first format, HTML, calls this format to retrieve the data. This does mean that
the SQL is executed twice. It is necessary because the chart component should not be
rendered if there is no data for the player/game combination; instead, a message should
be displayed. You can detect that by running the computation for the HTML format as
well as the other formats.
The last format isn??™t used in the example, but it demonstrates how easy it is to add
machine-readable formats to Rails 2.0 applications. The XML format can be read by an
application written in almost any language, as well as a desktop application such as
Microsoft Access. For example, the XML generated by this code for player Matthew
Gifford and game Tech Website Baron can be seen at the URL http://localhost:3000/
performance/5/1.xml and looks like this:
5
Tech Website Baron
Moxie
1
CHAPTER 5 n CONNECTING YOUR REPORTS TO THE WORLD 104
Matthew Gifford
m_giff
89000.
Pages:
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162