Quickly Build HTML5 and PhoneGap Mobile Apps

Manipulating Tiggzi Components with jQuery Mobile

Posted: March 28th, 2012 | Author: | Filed under: Articles | Tags: , , | 4 Comments »

Do you know how to take advantage of custom JavaScript when working with Tiggzi visual components? You can easily access any Tiggzi component in JavaScript via the Tiggzi JavaScript API and manipulate it with the jQuery Mobile API. Here is an example of how to dynamically add items to a list using JavaScript.

On the page, we have the following components: a list named platformsList, a text input named newPlatformField, and a button.

We are going to execute custom JavaScript code on the button click event. Select the button first, go to Events tab in the right panel, and then add a Click event with an action called Run Custom JavaScript.

Paste in the following code:

var list = Tiggr("platformsList");
var newPlatform = Tiggr("newPlatformField").val();
list.append("<li><a>" + newPlatform + "</a></li>").listview("refresh");
Tiggr("newPlatformField").val("");

Note the way we address Tiggzi components using the Tiggzi API. In order to get the reference to the component with a particular name for use in JavaScript we use the following API call:

Tiggr("<component name>")

In the code above, we put a reference for a list component into a list variable and put the value of the text input into a newPlatform variable using the jQuery val function. Then, we use the append method to add a new item with the text we’ve entered in the field and refresh the view using the listview method. Finally, we clear the value of the input field.

Let’s test the project in the browser. As you might already know, we are working on Blackberry and Windows Phone support for Tiggzi, so let’s add them into our list.

You can try it yourself.

Updated 3/29/2012

The post was changed to reflect use of the Tiggzi JavaScript API.


4 Comments on “Manipulating Tiggzi Components with jQuery Mobile”

  1. 1 yanuar said at 12:19 on July 2nd, 2012:

    Hi there,
    when will you support the development for blackberry?

    thankyou…

  2. 2 max said at 12:59 on July 2nd, 2012:

    @yanuar: You can build for BlackBerry today. Create an HTML5 mobile app and then take it to PhoneGap Builder to create a BlackBerry binary.

  3. 3 yanuar said at 04:01 on July 16th, 2012:

    great then!

    one more Q :
    if i create an app of iphone using tiggzi,
    can i distribute it without going to the appstore?

  4. 4 max said at 09:35 on July 16th, 2012:

    @yanuar: No. Can any one do that ?


Leave a Reply


  • 8 + = sixteen