搜索
查看: 1856|回复: 0

5种场合需要用action button

[复制链接]

634

主题

1182

帖子

4030

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
4030
发表于 2017-5-4 17:32:55 | 显示全部楼层 |阅读模式
https://shiny.rstudio.com/articles/action-buttons.html
不想翻译,看标题就够了
但是要注意,action button和submition button有区别:现在推荐用action button,不要用submit buttons

Aside: about submit buttons
Before action buttons existed in Shiny, there were only submit buttons. At this point, our general recommendation is to avoid submit buttons and only use action buttons. Note that any code that uses a submit button can be converted to code that uses an action button instead (while the reverse is generally not true) – see example at the bottom.

How are submit buttons and action buttons different?
With an action button, input values are sent from the browser to the server as usual (when they’re changed) but you can control the reactive flow of the program by telling particular reactives to not compute until the action button is pressed. In contrast, if your app includes a submit button anywhere, none of the inputs will be sent from the client to the server until the button is pressed. However, submit buttons have unusual behavior in many ways, and we recommend that they not be used for anything but the simplest apps.

These issues include the following: A submit button has a global scope, so there is no way of specifying which inputs should be on hold and which shouldn’t. If an app has two submit buttons, both of them will control the entire app, which is probably not what you want. Also, dynamically created submit buttons (for example, with renderUI() or insertUI()) will not work.

你这个问题很复杂,需要打赏,请点击 http://www.bio-info-trainee.com/donate 进行打赏,谢谢
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|小黑屋|生信技能树 ( 粤ICP备15016384号  

GMT+8, 2019-10-14 22:12 , Processed in 0.027215 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.