fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [11215] controller: test dynamic change width of sele


From: Sigurd Nes
Subject: [Fmsystem-commits] [11215] controller: test dynamic change width of select
Date: Fri, 28 Jun 2013 11:18:55 +0000

Revision: 11215
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11215
Author:   sigurdne
Date:     2013-06-28 11:18:54 +0000 (Fri, 28 Jun 2013)
Log Message:
-----------
controller: test dynamic change width of select

Modified Paths:
--------------
    trunk/controller/js/controller/ajax_control_to_location.js

Modified: trunk/controller/js/controller/ajax_control_to_location.js
===================================================================
--- trunk/controller/js/controller/ajax_control_to_location.js  2013-06-28 
10:03:22 UTC (rev 11214)
+++ trunk/controller/js/controller/ajax_control_to_location.js  2013-06-28 
11:18:54 UTC (rev 11215)
@@ -9,7 +9,7 @@
        //      $("#hidden_control_area_id").val( control_area_id );
     //     var control_id_init = $("#hidden_control_id").val();
          var htmlString = "";
-
+                var width = 35;
          $.ajax({
                        type: 'POST',
                        dataType: 'json',
@@ -22,16 +22,20 @@
                                        $.each(obj, function(i) {
 
                                                var selected = '';
-/*
-                                               if(obj[i].id == control_id_init)
+                                               var title = obj[i].title;
+                                               
+                                               if(title.length > width)
                                                {
-                                                       selected = ' selected';
+                                                       width = title.length;
                                                }
-*/
-                                                       htmlString  += "<option 
value='" + obj[i].id + "'" + selected + ">" + obj[i].title + "</option>";
+                                               
+                                               htmlString  += "<option 
value='" + obj[i].id + "'" + selected + ">" + obj[i].title + "</option>";
                                        });
                                         
                                        $("#control_id").html( htmlString );
+                                       //$('#control_id').css('width', width + 
'em');
+                                       width = width/2;
+                                       $('#control_id').width(width + 'em');
                                        }
                                        else
                                        {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]