demo: Adjust textarea height automatically
authorYoumin Ha <youmin.ha@samsung.com>
Sat, 19 Jan 2013 12:58:03 +0000 (21:58 +0900)
committerYoumin Ha <youmin.ha@samsung.com>
Tue, 22 Jan 2013 05:26:05 +0000 (14:26 +0900)
Tizen browses does not set textarea height automatically, while chrome
does it. So automatic textarea height calculation routine is added.
Fixes N_SE-21257.

Change-Id: I5f6eac0469f2c845d69495de26ce8f0805418698

demos/tizen-winsets/main.js
demos/tizen-winsets/widgets/button/buttonNolist.html

index acf97bc..68faaa5 100755 (executable)
@@ -163,10 +163,23 @@ $( document ).bind("pagecreate", function () {
                        // TODO: 'create' is called twice!!
                });
        });
+
+       // Expand all textarea height automatically
+       $('#ButtonNolist').live( "pagecreate", function ( ev ) {
+               var page = $( ev.target );
+               $( page ).bind( 'pageshow' , function ( ) {
+                       var textarea = page.find('textarea');
+                       $( textarea ).each( function ( idx, el ) {
+                               var h = Math.max( el.clientHeight, el.scrollHeight );
+                               $( el ).height( h );
+                       } );
+               } );
+       } );
+
 });
 
 $(document).bind( "pageinit" , function() {
-       $.mobile.tizen.enableSelection($("div:jqmData(role='page')"), 'none');
+       $.mobile.tizen.enableSelection( $("div:jqmData(role='page')"), 'none' );
 });
 $(document).ready( function () {
        // add current datetime with browser language format
index 640eb69..a97ab4b 100644 (file)
@@ -8,10 +8,12 @@
         <script src="js/"></script>
         <script src="theme.js"></script>
         <script src="js/jquery.mobile.forms.button.extension.js"></script>
+
+
         </head>
 <body>
 
-<div data-role="page" id="ButtonDemo" data-add-back-btn="true" >
+<div data-role="page" id="ButtonNolist" data-add-back-btn="true" >
         <div data-role="header" data-position="fixed">
                 <h1>Buttons</h1>
         </div>
@@ -87,6 +89,5 @@
        <div data-role="footer">
        </div>
 </div>
-
 </body>
 </html>