Book Image

Building UIs with Wijmo

By : Yuguang Zhang
Book Image

Building UIs with Wijmo

By: Yuguang Zhang

Overview of this book

Until recently, writing applications using JavaScript and HTML was difficult, because developers had to make the user interface by themselves; however, this started changing with the introduction of JavaScript libraries such as jQuery, jQuery UI, and KnockoutJS. An extension of jQuery UI, Wijmo adds features and widgets on top of jQuery UI and makes it easier to add user interface widgets to HTML documents. Building UIs with Wijmo gives you a tour of what Wijmo offers at a glance. With code recipes and well-explained examples, you will be able to use Wijmo in no time. The book gives details on options not explained in the documentation and helps you avoid those that don't work. The examples only feature the necessary code, with recommendations and best practices. This book introduces Wijmo, grouping widgets by their common application area or usage. It walks the user through the features of the dialog widget with examples as an introduction to the library. Then, widgets for forms, images, tootips, and other topics are explored. Features only available in the Wijmo dialog widget compared to the jQuery UI widget are thoroughly explained with examples. Common form components such as checkboxes, dropdowns, and inputs have Wijmo counterparts which keep the theme consistent and add functionalities. When Wijmo is used with Knockout, the UI automatically refreshes when the data changes. This book takes it further with WebSockets for two way communication between the server and client. With Building UIs with Wijmo, you will learn all the common web development components in Wijmo. You will get started using Wijmo in no time.
Table of Contents (15 chapters)

Using the gallery widget


As mentioned in the section on the carousel widget, the gallery widget displays navigable thumbnails by default. Selecting a thumbnail shows a larger version of the image above it.

Creating the gallery widget

As you might expect by now, the Wijmo gallery widget is created with the wijgallery method:

$("#wijgallery").wijgallery({
  thumbsDisplay: 3
});

This gallery is created with as much reuse of the carousel example as possible. For the gallery, we only limit the width on the container as it needs space to display the thumbnails:

#wijgallery {
  width: 300px;
}

We set the number of thumbnails to 3 due to the horizontal area below our images. Wijmo automatically crops the images for the thumbnails. Our gallery widget now looks like the one shown in the following screenshot:

In the example, we used the same HTML list format as for the carousel. Nevertheless, the Wijmo documentation recommends another format:

<div id="wijgallery">
  <ul>
    <li><a href...