Diaog open回調函數只執行一次

[英]Diaog open callback function executes only once


My jQueryUI dialog open callback function executes only for the first time the dialog opens but I want it to work every time I open the dialog. Can anyone help?

我的jQueryUI對話框打開回調函數僅在對話框第一次打開時執行,但我希望每次打開對話框時它都可以工作。有人可以幫忙嗎?

$('<div><b><center>'+ text +'</center></b></div>').dialog({
    title: '<b>User(s) with a similar name</b>', 
    modal: true,
    autoOpen: true,
    height: 'auto', 
    width: 400,
    resizable: false,
    open: function() { 
        $('#smartpaginate').smartpaginator({ 
            totalrecords: 3,
            recordsperpage: 2, 
            datacontainer: 'all-tabs', 
            dataelement: 'table',
            theme: 'green' 
        });
    },
    buttons: {
        "Close": function() {
            //alert($(this).attr('class'));
            $(this).dialog('close');
            return false;
        }
    }
});

The code in the callback executes a pagination plugin, Jquery smart paginator.

回調中的代碼執行分頁插件Jquery智能分頁器。

1 个解决方案

#1


1  

As said, this code snippet is not enough to understand your problem. See in this fiddle that the open callback function is always called. I have just added a smartpaginate div and a button to control the dialog opening :

如上所述,此代碼段不足以理解您的問題。在這個小提琴中看到始終調用開放回調函數。我剛剛添加了一個smartpaginate div和一個按鈕來控制對話框的打開:

<button id="opener">open the dialog</button>
<div id="dialog" title="Dialog Title"><div id="smartpaginate"></div></div>

And a message to visualize that the call is performed :

並顯示一條消息,顯示執行調用:

$('#opener').after('<p>dialog open function triggered</p>');

Maybe you should have a look in your js console, and give us more context.

也許你應該看看你的js控制台,並給我們更多的背景。


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2012/12/11/af5acc4d65f6dfa4e84535043bc73cad.html



 
  © 2014-2022 ITdaan.com 联系我们: