gallery: adds function that set the index to value API
authorMinkyu Kang <mk7.kang@samsung.com>
Mon, 14 Jan 2013 05:46:46 +0000 (14:46 +0900)
committerMinkyu Kang <mk7.kang@samsung.com>
Tue, 15 Jan 2013 07:26:05 +0000 (16:26 +0900)
Set current index if parameter is exist

Change-Id: I22e3ede83330ac0485209840ba81d92b0d6c504f

src/widgets/gallery/js/jquery.mobile.tizen.gallery.js

index 9c9937f..df47fd6 100755 (executable)
@@ -39,7 +39,7 @@
  *  refresh(index): refresh the widget, should be called after add or remove. (parameter: start index)
  *  empty: remove all of images from the gallery
  *  length: get length of images
- *  value: get current index of gallery
+ *  value(index): get or set current index of gallery (parameter: index of image)
  *
  * Events
  *
 */
 /**
        @method value
-       The value method is used to get current index of gallery.
+       The value method is used to get or set current index of gallery. The image_index attribute defines the index of the image to be set. If not get current index.
 
                <div id="gallery" data-role="gallery" data-vertical-align="middle"></div>
                value = $("#gallery").gallery('value');
+               $("#gallery").gallery('value', [image_index]);
 */
 (function ( $, window, undefined ) {
        $.widget( "tizen.gallery", $.mobile.widget, {
                        return this.images.length;
                },
 
-               value: function () {
-                       return this.index;
+               value: function ( index ) {
+                       if ( index === undefined ) {
+                               return this.index;
+                       }
+
+                       this.refresh( index );
                }
        }); /* End of widget */