2012-12-11 60 views
1

jQuery UI的对话框打开回调执行只有一次,但我想它要在每次打开的对话框中一次执行每次..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的回调函数正确执行并生成分页,但是在关闭之后,每次打开时都没有分页。

+0

,能得到任何JavaScript错误? –

+2

你怎样称呼open()对话框? 'autoOpen:true'在默认情况下是无用的,它被设置为true。 –

回答

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