簡體   English   中英

除非直接在對話框函數中輸入html,否則無法從jqgrid編輯表單中打開對話框

[英]Cannot get a dialog box to open from inside a jqgrid edit form unless the html directly entered into the dialog function

我嘗試了多種描述“ dialog-1”的方法,但均無濟於事。 如果從那里調用對話框函數,則相同的代碼可以很好地用作頁面主體的一部分。 相同的代碼在表單內部不起作用。

謝謝你的幫助。

此功能可以很好地顯示對話框。

function helpSThtml () {
$(function() {
    $( "<div id='dialog-1' title='Dialog Title goes here...'>This my first jQuery UI Dialog!</div>" ).dialog({
        height: 140,
        modal: true,
        open: function (event, ui) {
            $('.ui-dialog').css('z-index',950);
            $('.ui-widget-overlay').css('z-index',949);
        },
    });
});
}

該功能似乎什么也不做。

function helpSTvar () {
$(function() {
    $( "#dialog-1" ).dialog({
        height: 140,
        modal: true,
        open: function (event, ui) {
            $('.ui-dialog').css('z-index',950);
            $('.ui-widget-overlay').css('z-index',949);
        },
    });
});
}

</script>

<div id="dialog-1" title="Dialog Title goes here...">This my first jQuery UI Dialog!</div>
</head>

似乎div標簽在標題部分中,應該在正文中

<!DOCTYPE html>
<html>
<head>
</head>
<body>
    <div id="dialog-1" title="Dialog Title goes here...">This my first
    jQuery UI Dialog!</div>

</body>
</html>

試試吧!

  1. 您的<div>必須位於<body>而不是<head>

  2. 在每個函數中都包含$(function(){不是一個好習慣,相反,您應該這樣做:

     function helpSTvar () { $( "#dialog-1" ).dialog({ height: 140, modal: true, open: function (event, ui) { $('.ui-dialog').css('z-index',950); $('.ui-widget-overlay').css('z-index',949); }, }); } $(function(){ helpSTvar(); // call one or more functions when document's ready }); 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM