Archive

Archive for the ‘Javascript’ Category

An extensions library for Sencha Touch

June 24th, 2011

Some of you may already know Sencha Touch but for those who are in mobile application development and haven’t heard of it yet, it is a mobile application development framework designed especially for devices with touch screens. It provides all the basic touch screen events and a whole bunch of components to use to create interactive applications. You can even convert your mobile apps into native apps via the magical PhoneGap and submit them to AppStore or Android Store. (Blackberry is also supported but… who cares?)

Even though lots of components are provided out-of-box, you still need to tweak a little bit to create the exact components you need. As documentation lacks some really useful information and even with all the tutorials provided it is not an easy task to put every bit together and create an application with Sencha Touch. After weeks of suffering, I managed to develop an application completely based on this framework and here I share some of the outcome.

This library is meant to be an example to extend provided Sencha Touch components to create more complex behaviors. Components found in this library are generally based on or inspired by components in Sencha Touch library and are meant to be a guide to people learning how to put things to work with Sencha Touch. I hope it may save someone’s life :)

DidiTouch Javascript extensions library for Sencha Touch

And to the guys working on this framework at Sencha,

Keep up the good work, and please, more and better documentation!..

Javascript , ,

Getting selected values of an checkbox array with JQuery

July 1st, 2009

With JQuery it is extremely easy to collect the checked values of an checkbox array. You can use the code below to collect checked items of an array named “itemSelect[]” and give an alert if none of them are checked. This code submits the collected data via ajax to “/ajax_do_something.php” to process the data. If sucessfully processed it refreshes the page to display new data.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
var selectedItems = new Array();
$("input[@name='itemSelect[]']:checked").each(function() {selectedItems.push($(this).val());});
 
if (selectedItems .length == 0) 
    alert("Please select item(s) to delete.");
else
    $.ajax({
	type: "POST",
	url: "/ajax_do_something.php",
	data: "items=" + selectedItems.join('|'),
	dataType: "text",
	success: function (request) {
	    document.location.reload();
	  },
	error: function(request,error){
	    alert('Error deleting item(s), try again later.');
	  }
	}
    )

JQuery, Javascript, Programming