1

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;
    }
  }
});

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

4

1 回答 1

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;
    }
  }
});
于 2012-12-11T13:10:20.417 回答