简体   繁体   English

atk4对话框URL关闭按钮

[英]atk4 dialogURL close button

I'm using atk dialogURL with button false, i've some fields and added my buttons: 我正在使用带有false按钮的atk dialogURL,我有一些字段并添加了我的按钮:

$f2->addSubmit();
$f2->addButton('Close')->js('click',$f2->js()->univ()->closeDialog());
if($f->isSubmitted()){
        $f->update();
}

after push "Save" button my dialog don't close (I don't want it) then I click my close button dialog, but appear : 按下“保存”按钮后,我的对话框不关闭(我不想要),然后单击关闭按钮对话框,但出现:

"'Changes on the form will be lost. Continue?'" “'表单更改将丢失。继续吗?'”

why? 为什么? my data is correct saved in database. 我的数据正确保存在数据库中。 Seem that .form_changed is not updated 似乎.form_changed没有更新

inside isSubmitted, you need to explicitly close the dialog: 在isSubmitted内部,您需要显式关闭对话框:

if($f->isSubmitted()){
    $f->update();
    $f->js()->univ()->closeDialog()->execute();
}

By default before dialog is destroyed it checks if it's been changed. 默认情况下,对话框销毁之前,它会检查对话框是否已更改。 It's implemented by adding a class (form_changed) to the form tag. 它是通过向form标签添加一个类(form_changed)来实现的。 You have few other options. 您还有其他选择。 For example, you can remove the form altogether: 例如,您可以完全删除该表单:

if($f->isSubmitted()){
    $f->update();
    $f->js()->remove()->execute()
}

Or: 要么:

$this->addButton('Close')->js('click',
    $form->js()->find('form')->removeClass('form_changed')
)->univ()->closeDialog();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM