2017-07-13 10 views
0

私はダイアログモーダルを持っており、選択フィールドとテーブルを追加したいと思います。jquery uiダイアログモーダルに複数のフィールドを追加

ダイアログモーダルと選択フィールドのHTMLの記述とテーブルのフィールド

<div id="task_properties" style="display:none;"> 
</div> 

<div id="properties-list" class="ui-widget"> 

     <table id="list_task_properties" class="ui-widget_task ui-widget-content"> 
     <thead> 
      <tr class="ui-widget-header"> 
       <th>Id</th> 
      </tr> 
     </thead> 
     <tbody> 

     </tbody> 
     </table> 
    </div> 

    <select class="dropdown-toggle" id="selection" style="display:none;"> 
</select> 

があると私は、ダイアログモーダル

function openTaskPropertiesAssignee(taskId){ 
$('#task_properties').dialog({ 
    height: 520, 
    width: 400, 
    modal: true, 
    title: taskId, 
    draggable:true, 
    open: function() { 
     $('#selection').css("display","block"); 
     $('#list_task_properties').css("display","block"); 
     $(this).html($('#selection')); 
     $(this).html($('#list_task_properties')); 

    }, 
    buttons: { 
     AddPropertie:{ 
      'class':"add_propertie_button", 
      text: 'add propertie', 
      click:function(){ 

      } 
     }, 
     Ok: function() { 
      $(this).dialog("close"); 
     } 
    } 
}); 
$("#selection").change(function(){ 
    console.log($("#selection :selected").text()); 
});} 

しかし、私を管理jqueryのコードがあります私は(テーブル)を追加した最後のフィールドしか持っていないので、両方のフィールド(テーブルと選択)が見えません。

誰もが私が間違っているところを教え、または私にjqueryの宇井ダイアログ形式で

答えて

0

の.htmlを二つのフィールドを追加する方法の例を取る()は、メソッドを使用するたびにdivの内容を上書きすることができます。

$(this).append($('#selection')); 
$(this).append($('#list_task_properties')); 

それとも、また

$(this).html($('#selection')); 
$(this).append($('#list_task_properties')); 
+0

はい、まさにこの使用することができますので、()、同様に代わりの.htmlの)(.appendを使用。問題は.html()が.append()を使用して複数のフィールドを追加できるようにしてコンテンツを上書きすることでした。ありがとう@Prk –

関連する問題