jQuery UI对话框打开回调只执行一次,但我想让它在每次打开对话框时执行

时间:2012-12-11 12:17:53

标签: jquery jquery-ui user-interface

jQuery UI对话框打开回调只执行一次,但我想让它在每次对话框打开时执行..

$('<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(){
      $(this).dialog('close');
      return false;
    }
  }
});

open的回调函数正确执行并生成分页,但在关闭后,每次打开时都没有分页。

1 个答案:

答案 0 :(得分:0)

尝试从DOM中删除对话框:

$('<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(){
$(this).remove();
      return false;
    }
  }
});