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 联系我们: