2017-05-03 1 views
0

안녕하세요. 내 응용 프로그램에 dhtmlx 양식을 사용하고 있습니다. 사용자가 텍스트 상자에 텍스트를 입력하면 콘솔에서 볼 수있는 데이터베이스에서 제안 자동 완성 기능을 원합니다. 그러나이 입력 상자 아래에 추천 목록을 표시하지 않습니다. 내가 ---- 스크립트 부분에서 ajax를 사용하여 dhtmlxform의 입력 텍스트 상자에서 자동 완성 제안이 작동하지 않습니다.

<script src="js/jquery-1.11.1.min.js"></script> 
    <script src="js/jquery-ui.min.js"></script> 
    <link rel="stylesheet" type="text/css" href="dhtmlx/dhtmlxSuitePRO/codebase/dhtmlx.css" /> 
    <link rel="stylesheet" href="dhtmlx/dhtmlxScheduler/codebase/dhtmlxscheduler.css" type="text/css" media="screen" title="no title" charset="utf-8"> 
    <script src="dhtmlx/dhtmlxSuitePRO/codebase/dhtmlx.js"></script> 
    <script src="dhtmlx/dhtmlxScheduler/codebase/dhtmlxscheduler.js" type="text/javascript" charset="utf-8"></script> 
    <script src='dhtmlx/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_tooltip.js' type="text/javascript" charset="utf-8"></script> 
    <script src="dhtmlx/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_all_timed.js" type="text/javascript" charset="utf-8"></script> 
    <script src="dhtmlx/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_minical.js" type="text/javascript" charset="utf-8"></script> 
    <script src="dhtmlx/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_serialize.js" type="text/javascript" charset="utf-8"></script> 

파트 - 헤더에서 음을

var layoutObj6 = document.getElementById("layoutObj6"); 
myLayout6.cells("a").setText(" Impersonation:"); 
myImpersonationFormData = [ 
      {type: "block", list:[ 
      {type: "input", name: "txtImpersonate", id: "txtImpersonate", offsetLeft: 0, inputWidth: 125}, 
      {type: "newcolumn"}, 
      {type: "button", value: "Set", name: "btn_impersonate", id: "btn_impersonate", width: 20} 
      ]} 
      ]; 

myImpersonationForm = 
myLayout6.cells("a").attachForm(myImpersonationFormData); 
myLayout.cells("a").appendObject(layoutObj6); 
myImpersonationForm.attachEvent("onInputChange", function (name, value,myImpersonationForm){ 
if(name == 'txtImpersonate'){ 
     $.ajax({ 
       url : "/MyProject/GetUserList", 
       type : "GET", 
       data : { user : value}, 
       dataType : "jsonp", 
       success : function(data) { 
        response(data.userList);// can see the list in browser console 
        }, 
       error: function(jqXHR, textStatus, errorThrown){ 
       alert("ERROR!!! \n \n System Error code: " + jqXHR.status + "\n \n Please contact Server administrator.);       
        } 
       }); 
       } 
      }); 

답변

0

을이 작품 ......

을 만들 수있는 방법을 제안 해주십시오, 내가 가진 dhtmlx 입력 상자에 대한 자동 완성 기능을 지원하지 않지만 dhtmlx 콤보에 이미 사용 중입니다.

그래서 나는 다른 방법을 찾아 냈습니다. 입력 상자를 dhtmlx 대신 html 텍스트 상자로 정의하십시오. 여기에 JQuery와 ajax를 추가한다. 그것은 매력처럼 작동합니다. dhtmlx 팀이 텍스트 상자에 대한 자동 완성 기능을 제공하기를 바랍니다.

myImpersonationForm = myLayout6.cells("a").attachHTMLString('<input type="text" class="inputTextClass" id = "txtImpersonate" name ="txtImpersonate" />' 
+' <button id="btn_impersonate" class="btnSetClass" name="btn_impersonate" onclick="javascript:fnImpersonateSet();">Set</button></form> '); 
$(document).ready(function() { 
      window.history.forward(1); 
      $(function() { 
       $("#txtImpersonate").autocomplete({ 
         source : function(request,response) { 
         if (request.term.length < 3) { 
          //don't do anything 
          return; 
         } 
         $.ajax({ 
          url : imUrl, 
          type : "GET", 
          data : { user : request.term}, 
          dataType : "jsonp", 
          success : function(data) { 
          response(data.userList); 
          }, 
         error: function(jqXHR, textStatus, errorThrown){ 
           alert("ERROR!!! \n \n System Error code: " + jqXHR.status + "\n \n Please contact your Server administrator. ");       
         } 
         }); 
       }, 
       autoFocus : true, 
       scroll : true 
      }); 
      }); 
     }); 
관련 문제