2013-06-05 79 views
0

我可以實現打開一個新的對話框,但是在edit-/add-dailog後打開。我怎樣才能讓它在編輯/添加對話框前打開?如果我對警報箱做同樣的事情,它會立即起作用。jqGrid在編輯/添加對話框前打開對話框

<style> 
.dialogue{ z-index: 1000; } 
</style> 
<script type="text/javascript"> 
jQuery(document).ready(function(){ 
    $('#A').dialog({ 
     autoOpen: false, 
     buttons: { 
      "Open Dialog B": function(){ 
      $('#B').dialog('open'); 
      } 
     } 
    }); 
    $('#B').dialog({ 
     autoOpen: false 
    }); 

    jQuery("#list").jqGrid({ 
     sortable: true, 
     url:'{{=URL('get',args=table)}}', 
     datatype: 'json', 
     mtype: 'GET', 
     colNames:{{=h}}, 
     colModel :{{=b}}, 
     ondblClickRow: function (rowid) { 
      myClickHandle.call(this, rowid); 
     }, 
     jsonReader: { 
      repeatitems: false 
     }, 
     width: 1024, 
     height: '100%', 
     pager: '#gridpager', 
     rowNum:10, 
     rowList:[10,20,30], 
     sortname: 'id', 
     sortorder: 'desc', 
     viewrecords: true, 
     gridview:true, 
     caption: '{{=table}}', 
     editurl:'{{=URL('adu',args=table)}}' 

    }); 
    jQuery("#list").jqGrid('navGrid','#gridpager', 
          {edit:true}, 
          { beforeShowForm: function(form) { 
           $('.basic').live('click',function() { 
        $('#A').dialog("open"); 
      }); 
         }, 

        width:500,height:'100%', 
        reloadAfterSubmit:false, 
        closeAfterEdit:true}, // edit options 
        {width:500,height:'100%', 
        closeAfterAdd:true}, // add options 
        {reloadAfterSubmit:false, 
        closeAfterSubmit:true}, // del options 
      {} // search options 
      ); 
    jQuery("#list").jqGrid('navButtonAdd','#gridpager',{ 
     caption: "", 
     title: "Reorder Columns", 
     onClickButton : function(){ 
      jQuery("#list").jqGrid('columnChooser',{ 
       done: function(perm) { 
        if (perm) { 
        var gridWidth = this.jqGrid('getGridParam', 'width'); 
         this.jqGrid('setGridWidth', gridWidth); 
         this.jqGrid('remapColumns', perm, true); 
         $.ajax({ 
          type: 'POST', 
          contentType: 'application/json; charset=utf-8', 
          url: "{{=URL('ps',args=(table,id))}}", 
          data: $('#list').jqGridExport({ 
           exptype: 'jsonstring', 
           root: 'Settings' 
          }) 
         }); 
        } 
       } 
      }); 
     } 
    }); 

}); 
</script> 
<table id="list"></table> 

<div id="gridpager"> 
</div> 
<div title="Dialog A" id="A" class="dialogue">Dialog A</div> 
<div title="Dialog B" id="B" class="dialogue">Dialog B</div> 

迎接Kluther

回答

1

嘗試使用在對話中modal選項(的jsfiddle http://jsfiddle.net/r4meJ/):

$('#A').dialog({ 
    autoOpen: false, 
    modal: true, 
    buttons: { 
     "Open Dialog B": function(){ 
     $('#B').dialog('open'); 
     } 
    } 
}); 
$('#B').dialog({ 
    autoOpen: false, 
    modal: true 
}); 

這應該提供什麼你需要

+0

您好Bloafer,感謝您的快速反應。我用你的解決方案,但它似乎並沒有伎倆。我所做的:-add

Dialog A
Kluther

+0

您能否提供HTML和您呼叫對話的方式 – Bloafer

+0

我已將它放在原始文章中。 – Kluther