fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [9531] controller: register control to component


From: Sigurd Nes
Subject: [Fmsystem-commits] [9531] controller: register control to component
Date: Thu, 07 Jun 2012 08:22:20 +0000

Revision: 9531
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9531
Author:   sigurdne
Date:     2012-06-07 08:22:19 +0000 (Thu, 07 Jun 2012)
Log Message:
-----------
controller: register control to component

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

Modified: trunk/controller/js/controller/ajax_control_to_component.js
===================================================================
--- trunk/controller/js/controller/ajax_control_to_component.js 2012-06-07 
08:22:06 UTC (rev 9530)
+++ trunk/controller/js/controller/ajax_control_to_component.js 2012-06-07 
08:22:19 UTC (rev 9531)
@@ -123,6 +123,11 @@
          });
     });
 
+       $("#location_type_category").change(function () {
+               var level = $("#location_type").val();
+               update_loc(level);
+    });
+
        //update part of town category based on district
        $("#district_id").change(function () {
                var district_id = $(this).val();
@@ -325,6 +330,59 @@
        });
 });
 
+
+function update_loc(level)
+{
+       var oArgs = {
+               menuaction:'property.bolocation.read',
+               cat_id:$("#location_type_category").val(),
+               district_id:$("#district_id").val(),
+               part_of_town_id:$("#part_of_town_id").val(),
+               location_code:$("#loc1").val(),
+               type_id:level
+       };
+
+                var requestUrl = phpGWLink('index.php', oArgs, true);
+
+         var htmlString  = "<option value=''>Velg</option>";
+
+         $.ajax({
+                       type: 'POST',
+                       dataType: 'json',
+                       url: requestUrl,
+                       success: function(data) {
+                               if( data != null)
+                               {
+                                       var obj = data;
+                                               
+                                       $.each(obj, function(i)
+                                       {
+                                               htmlString  += "<option 
value='" + obj[i].location_code + "'>" +  obj[i].location_code + " " + 
obj[i]["loc"+level+"_name"] + "</option>";
+                                       });
+                                                                               
                        
+                                       $("#loc" + level).html( htmlString );
+                                       if(level == 1)
+                                       {
+                                       $("#loc2").html( "<option value=''>Velg 
Eiendom først</option>" );
+                               }
+                                       if(level == 2)
+                                       {
+                                       $("#loc1").html( "" );
+                               }
+                               }
+                               else
+                               {
+                               htmlString  = "<option>Ingen</option>";
+                               $("#loc1").html( htmlString );
+                               $("#loc2").html(htmlString);
+                       }
+                       }
+         });
+
+
+
+}
+
 function get_table_def()
 {
        var oArgs = {




reply via email to

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