Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Building UIs with Wijmo
Building UIs with Wijmo

Building UIs with Wijmo: Wijmo lets you use widgets on your websites for more flexibility and ease of use in the user interface. This book shows you how with a refreshingly logical and example-led approach that makes learning a pleasure.

By Yuguang Zhang
$19.99 $13.98
Book Sep 2013 116 pages 1st Edition
eBook
$19.99 $13.98
Print
$32.99
Subscription
$15.99 Monthly
eBook
$19.99 $13.98
Print
$32.99
Subscription
$15.99 Monthly

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Buy Now

Product Details


Publication date : Sep 19, 2013
Length 116 pages
Edition : 1st Edition
Language : English
ISBN-13 : 9781849696067
Vendor :
GrapeCity
Category :
Concepts :
Table of content icon View table of contents Preview book icon Preview Book

Building UIs with Wijmo

Chapter 1. Getting Started with Wijmo

Wijmo is composed of over 40 user interface widgets ranging from form components to enterprise charts. All of the widgets come with themes. The best features about Wijmo are:

  • Wijmo is easy to use. It is a complete set of widgets with a wide array of configuration options. Chances are that Wijmo has a widget for every UI component you've used in your projects.

  • It deals with implementation differences between browsers. All versions of IE since version 6 and other browsers are supported.

  • It has Platinum support. Although the live phone support costs an annual fee, your team will never get stuck or experience downtime while working with Wijmo.

  • It is open source and is hosted on a repository on GitHub with a GPL license for open source applications.

Not everything is perfect. Wijmo comes with its rough edges. In this book, I point out the pitfalls and guide you around them. The benefit of learning from this book is that you won't make the mistakes I've made. Learning Wijmo makes web development simpler, quicker, and more enjoyable.

Setting up Wijmo


Downloading and installing Wijmo only takes a few more steps compared to jQuery UI. It has files hosted on a content distribution network for a quick start. For this book, it is recommended that you download and set up the files for development. Since Wijmo is built on jQuery UI, I have included the details on obtaining and customizing jQuery UI. This chapter also covers how to install the minimized files for production environments.

Installing Wijmo the quick way via a CDN

Both jQuery and jQuery UI are hosted by Google and Microsoft on their Content Distribution Networks (CDNs). The Microsoft service hosts standard jQuery UI themes as well as JavaScript. To use a CDN, you need to find the URLs of the files that you want first. Microsoft has a page listing their hosted libraries at asp.net/ajaxlibrary/cdn.ashx. If you click on the jQuery UI releases under the Table of Contents, several versions are listed. Clicking on a version will show you the URLs for the minified and regular versions. For example, jQuery UI 1.10.2 has the following URL:

http://ajax.aspnetcdn.com/ajax/jquery.ui/1.10.2/jquery-ui.min.js

The page also has a nice visual gallery of all the themes for the version, with the URL for the CSS theme below each theme. The URL for Cupertino is:

http://ajax.aspnetcdn.com/ajax/jquery.ui/1.10.2/themes/cupertino/jquery-ui.css

However, the reader is encouraged to select from one of the Wijmo themes, as they are more compatible with the library. Wijmo has a Theme Explorer (http://wijmo.com/demo/themes/) showcasing six themes (as of version 3.20131.1) as shown in the following screenshot:

The URL for the Rocket theme is:

http://cdn.wijmo.com/themes/rocket/jquery-wijmo.css

Wijmo provides a separate CSS for Widgets that change with each version. The URLs take the form: http://cdn.wijmo.com/jquery.wijmo-pro.all.[version].min.css. For the version at the time of writing this book, the form is: http://cdn.wijmo.com/jquery.wijmo-pro.all.3.20131.1.min.css.

The JavaScript files for Wijmo follow a similar format:

To use Wijmo via a CDN, these URLs must be placed in script and link elements, as shown:

<!DOCTYPE HTML>
<html>
<head>
  <title>Example</title>
  <!--jQuery References-->
  <script src="http://code.jquery.com/jquery-1.9.1.min.js" type="text/javascript"></script>
  <script src="http://code.jquery.com/ui/1.10.1/jquery-ui.min.js" type="text/javascript"></script>
  <!--Wijmo Widgets JavaScript-->
  <script src= "http://cdn.wijmo.com/jquery.wijmo-open.all.3.20131.1.min.js" type="text/javascript"></script>
  <script src= "http://cdn.wijmo.com/jquery.wijmo-pro.all.3.20131.1.min.js" type="text/javascript"></script>
  <!--Theme-->
  <link href="http://cdn.wijmo.com/themes/aristo/jquery-wijmo.css"rel="stylesheet" type="text/css" />
  <!--Wijmo Widgets CSS-->
  <link href="http://cdn.wijmo.com/jquery.wijmo-pro.all.3.20131.1.min.css"rel="stylesheet" type="text/css" />
  <script id="scriptInit" type="text/javascript">
    $(document).ready(function () {
      $('#dialog').wijdialog({
        autoOpen: true,
        captionButtons: {
          refresh: { visible: false }
        }
      });
    });
  </script>
</head>
<body>
  <div id="dialog" title="Basic dialog">
    <p>Meet Wijmo.</p>
  </div>
</body>
</html>

If the Wijmo CDN files have been added properly, you should see a distinct "window" with the standard minimize, expand, and close buttons as shown in the following screenshot:

When browsers load JavaScript or CSS files, they check to see if the file is in the cache. If the user already has a cached version on his machine, then the browser loads from the cache instead of downloading the content. Serving jQuery over CDN will likely reduce the download size for the user. However, the Wijmo and jQuery UI libraries are less frequently used in web development so they are not likely to be cached. Instead of loading the full libraries from a CDN, creating a custom download with only the components used in your project, as covered in the next section, reduces the size. As a result, your web application will load faster.

Installing Wijmo for development

jQuery UI has five main areas of functionality. You can create a custom download that includes only the features necessary for your web application, resulting in a smaller library for browsers to download.

To avoid the pitfalls of using a jQuery UI theme, it is recommended to completely avoid the ThemeRoller on http://jqueryui.com. If Wijmo is configured with a jQuery UI theme such as Redmond, a few quirks will appear as show in the screenshot:

Customizing jQuery UI for download

The jQuery UI download page, http://jqueryui.com/download/, lets you select only the features required for your project to create a set of smaller files for the browser to download. This is usually a better idea than using a CDN, since jQuery UI has many releases each year and the chances of your project using the same version that the browser has already downloaded is low. For this book, download jQuery UI 1.10.2 with the default options. Later on, you will want to unselect the features that you don't use and see if your project still functions.

When customizing a jQuery UI library, the dependencies are sorted out for you. When a component is enabled, its dependencies are automatically selected. As you minimize your files for production, keep in mind that most of the effects along with some interactions and widgets may not be necessary. For example, only the slide effect is used in the accordion and dialog widgets. If your project only uses these widgets, then the other effects are not necessary.

Downloading Wijmo

To start, go to http://wijmo.com/downloads/ and scroll down to the bottom. There is a navigation panel on the right-hand side with the Downloads link as shown in the following screenshot:

This loads the Downloads page, which consists of a list of ways to include Wijmo in your project along with an introductory video, Get Started with Wijmo, at the bottom. Click on the Free Trial button to download Wijmo Professional. The licensing options, along with a comparison chart of features, are at the end of this chapter. After clicking on the Free Trial button, you will need to register an account if you're a new user. Once you log in with your new account, you will see a link to download the library and you will be able to see a screen as shown in the following screenshot:

You will notice that there are JavaScript and CSS files for individual components and features in the Wijmo folder. They can be helpful when you want to reduce the size of the download for production. Since only the current version of Wijmo is downloadable from the website, you will want to keep a backup of your download.

Installing jQuery UI for development

Inside the jQuery UI download both the minified files for production and the uncompressed source code for development are present. Using the development versions makes it easy to debug, as you don't have to step through the minified code. To set up your development environment, copy the files js\jquery-ui- 1.10.2.custom.js and js\jquery-1.9.1.js into a lib folder.

Installing Wijmo for development

Like the jQuery UI download, the Wijmo download contains all the files that you need for development and production. For this book, we will be using features in Wijmo Professional. Wijmo Professional depends on components in Wijmo Open. You need to copy the following files from the Wijmo download into the lib folder:

  • js\jquery.wijmo-open.3.20131.2.all.js

  • js\jquery.wijmo-pro.all.3.20131.2.js

  • css\jquery.open.css

  • css\jquery.wijmo-pro.3.20131.2.css

  • css\images

  • Themes\rocket\jquery-wijmo.css

  • Themes\rocket\images

When copying the theme images, merge the folder contents. Note that the image paths are relative in the CSS and will work as long as you have the folder in the same directory as the CSS file. The Wijmo Professional files include the version number of the release that was downloaded. These change with each release, while the image and theme files are relatively static. The version, as of early 2013, is 3.20131.2. Simply replace it with your version number for the rest of the book or just use the version 3.20131.2.

Adding Wijmo to an HTML document

All that remains is to add Wijmo to your HTML document. You can do this by adding the script and link elements to the files in the lib folder as shown:

<!DOCTYPE HTML>
<html>
<head>
  <title>Example</title>
  <!--jQuery References-->
  <script src="../lib/jquery-1.9.1.js" type="text/javascript"></script>
  <script src="../lib/jquery-ui.custom.js" type="text/javascript"></script>
  <!--Wijmo Widgets JavaScript-->
  <script src="../lib/jquery.wijmo-open.3.20131.2.all.js" type="text/javascript"></script>
  <script src="../lib/jquery.wijmo-pro.all.3.20131.2.js" type="text/javascript"></script>
  <!--Theme-->
  <link href="../lib/jquery-wijmo.css" rel="stylesheet" type="text/css" />
  <!--Wijmo Widgets CSS-->
  <link href="../lib/jquery.wijmo-open.3.20131.2.css" rel="stylesheet" type="text/css" />
  <link href="../lib/jquery.wijmo-pro.3.20131.2.css" rel="stylesheet" type="text/css" />
  <script id="scriptInit" type="text/javascript">
    $(document).ready(function () {
      $('#dialog').wijdialog({
        autoOpen: true,
        captionButtons: {
          refresh: { visible: false }
        }
      });
    });
  </script>
</head>
<body>
  <div id="dialog" title="Basic dialog">
    <p>Click OK to close this window.</p>
  </div>
</body>
</html>

Wijmo licensing

Wijmo Open is licensed under both MIT and GPL. The MIT license allows you to use the software in any way you want as long as the copyright attribution is kept. Wijmo Open is an expansion of jQuery UI with more widgets and options. A few of the widgets not included in jQuery UI that are in Wijmo Open are:

  • Expander

  • Radio Button

  • TextBox

  • DropDown

  • CheckBox

  • List

  • Popup

  • Splitter

  • SuperPanel

  • Video Player

Below the differences between jQuery UI and Wijmo are mentioned, showcasing which of the features are present in both or the other.

Wijmo Professional is intended for businesses developing closed-source projects. It includes everything from Wijmo Open, in addition to the following:

  • Charts

  • ComboBox

  • Datasource

  • Grid

  • Input

    • Date

    • Mask

    • Number

  • Media

    • Carousel

    • Gallery

    • Lightbox

  • Pager

  • Rating

  • Tree

  • Upload

  • Wizard

The license cost is per developer at a rate of $495 (https://wijmo.com/purchase/). However, ComponentOne does offer a GPLv3 license for use in open source applications.

Required background


Before reading this book, you should be familiar with HTML, CSS, JavaScript, and jQuery. jQuery UI knowledge is not required, but would be a bonus since Wijmo is similar to jQuery UI in many ways. Only the last chapter of the book, which is based on extending Wijmo, requires advanced CSS and JavaScript knowledge. A basic working understanding of web development will get you through this book. If the examples in this chapter come naturally to you, then you're well on your way to learning Wijmo.

Summary


By this point, you should have the most recent version of Wijmo set up for development. If not, the source code for all the examples in this book are available at https://github.com/yuguang/wijmo_essentials. Download it to a permanent location on your computer and you will have all the code at your disposal. All of the examples are MIT licensed, so you may use it in any way you want.

Now that you have Wijmo set up on your computer for development, you are ready to start exploring Wijmo. In the next chapter, we dive into the dialog widget and look at several features which are not available in jQuery's version.

In addition to setting up Wijmo, we've also covered its licensing details. If you plan to use any of the complete Wijmo widgets in a proprietary application, make sure to get a license.

Left arrow icon Right arrow icon

Key benefits

  • Learn to configure Wijmo components for common usage scenarios
  • Build adaptive websites that work on desktops and mobile devices
  • Integrate Wijmo with Knockout to develop real-time applications

Description

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.

What you will learn

Set up Wijmo for development and production Change the Dialog widget s appearance Replace form components with widgets Autoplay images with the Carousel widget Create a LightBox widget and customize its buttons Play videos in the Gallery widget Fix the appearance of the InputDate widget Program real-time applications with declarative bindings in the MVVM style

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Buy Now

Product Details


Publication date : Sep 19, 2013
Length 116 pages
Edition : 1st Edition
Language : English
ISBN-13 : 9781849696067
Vendor :
GrapeCity
Category :
Concepts :

Table of Contents

15 Chapters
Building UIs with Wijmo Chevron down icon Chevron up icon
Credits Chevron down icon Chevron up icon
About the Author Chevron down icon Chevron up icon
About the Reviewers Chevron down icon Chevron up icon
www.PacktPub.com Chevron down icon Chevron up icon
Preface Chevron down icon Chevron up icon
Getting Started with Wijmo Chevron down icon Chevron up icon
The Dialog Widget Chevron down icon Chevron up icon
Form Components Chevron down icon Chevron up icon
Working with Images Chevron down icon Chevron up icon
Advanced Widgets Chevron down icon Chevron up icon
Dashboard with WijmoGrid Chevron down icon Chevron up icon
Wijmo Mobile Chevron down icon Chevron up icon
Extending Wijmo Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Filter icon Filter
Top Reviews
Rating distribution
Empty star icon Empty star icon Empty star icon Empty star icon Empty star icon 0
(0 Ratings)
5 star 0%
4 star 0%
3 star 0%
2 star 0%
1 star 0%

Filter reviews by


No reviews found
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.