fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [12152] add autocomplete jquery helper


From: Alejandro
Subject: [Fmsystem-commits] [12152] add autocomplete jquery helper
Date: Fri, 10 Oct 2014 21:02:03 +0000

Revision: 12152
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=12152
Author:   nudrick
Date:     2014-10-10 21:02:01 +0000 (Fri, 10 Oct 2014)
Log Message:
-----------
add autocomplete jquery helper

Modified Paths:
--------------
    branches/dev-syncromind/phpgwapi/js/jquery/common.js

Modified: branches/dev-syncromind/phpgwapi/js/jquery/common.js
===================================================================
--- branches/dev-syncromind/phpgwapi/js/jquery/common.js        2014-10-10 
21:00:51 UTC (rev 12151)
+++ branches/dev-syncromind/phpgwapi/js/jquery/common.js        2014-10-10 
21:02:01 UTC (rev 12152)
@@ -11,3 +11,43 @@
        var link = oData['link'];
        return '<a href="' + link + '">' + name + '</a>';
 };
+
+JqueryPortico.autocompleteHelper = function(baseUrl, field, hidden, container, 
label_attr) {
+       $(document).ready(function () 
+       {
+               var oArgs = 
{menuaction:'property.uicondition_survey.get_users'};
+               var strURL = phpGWLink('index.php', oArgs, true);
+
+               $("#coordinator_name").autocomplete({
+                       source: function( request, response ) {
+                               $.ajax({
+                                       url: strURL,
+                                       dataType: "json",
+                                       data: {
+                                               location_name: request.term,
+                                               phpgw_return_as: "json"
+                                       },
+                                       success: function( data ) {
+                                               response( $.map( 
data.ResultSet.Result, function( item ) {
+                                                       return {
+                                                               label: 
item.name,
+                                                               value: item.id
+                                                       }
+                                               }));
+                                       }
+                               });
+                       },
+                       focus: function (event, ui) {
+                               $(event.target).val(ui.item.label);
+                               return false;
+                       },
+                       minLength: 1,
+                       select: function( event, ui ) {
+                         chooseLocation( ui.item.label, ui.item.value);
+                       }
+        });
+       });
+
+};
+               
+               
\ No newline at end of file




reply via email to

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