Creating JavaScript Code
Creating JavaScript Code
You can also create JavaScript code that runs on the
client side, such as in response to various grid events. I found
myself getting a little confused here because my urge was to open up the page
and put my JavaScript right in there. But then I started getting a little lost. I wanted to write a JavaScript function, whereby when an
entry form finishes sending its data to the server, it would notify a grid to
update itself. The way I had created the grid and form was a bit different from
the usual Alpha Five way of doing it, and, as such,
the other grid wasn't getting updated automatically. I simply wanted to write
some JavaScript that would update the other grid, but I wasn't sure exactly
where to do it.
That forced me to start uncovering an Alpha Five
feature I hadn't yet discovered, and that's when it all started to come
together.
In the grid properties screen of the
Alpha Five application, there are several places where you can add your own
custom JavaScript. You can double-click any of these properties, and a
window opens your
JavaScript code. In other words, you do the work from within the property editors when possible, rather than writing
the code directly into the pages. When you do so,
everything fits together perfectly.
The developers of Alpha Five have done an excellent job of
anticipating where you would likely want to add your own custom code, and they
give you places to do it rather than forcing you to hack apart the pages and insert
your JavaScript code yourself, while hoping you put it in the right place. When
I followed this best-practices approach, everything worked beautifully. In the
end,
I had a full-featured application. And although I went beyond the "codeless"
aspect to push the product to its limits, I still wrote very little code.
For programmers who really want to take this product to its extreme
limits, there's a full-featured code editor that enables you to create your own
XBasic code libraries. You can use a rich built-in
library,
too. Your original code libraries can then be loaded by both desktop and Web-based
applications. The XBasic code, of course, still runs only on the server, but
any JavaScript code you create runs on the client side. In the end, you
can create applications that are as powerful as the best Web applications out
there.









