Setting inputs from the server

Showing 1-12 of 12 messages
Setting inputs from the server Winston Chang 4/10/13 10:50 AM
Hi everyone -

We've added some new features on an experimental branch:
* Setting the values of input objects from the server
* Sending arbitrary Javascript from the server to run on the client

It's not yet merged into the master development branch, but if you are feeling brave and want to experiment with it, you can install it with:
  devtools::install_github('shiny', 'wch', 'set-input')

Please note that the API is still subject to change, and it's possible that this branch could break at any time. If you do play with it and have feedback about it works, we'd like to hear it!


Here's a demo of setting inputs:
Code:


And a demo of sending Javascript:
Code:


-Winston
Re: Setting inputs from the server Alberto Santini 4/11/13 3:20 AM
Hello Winston


On Wednesday, April 10, 2013 7:50:18 PM UTC+2, Winston Chang wrote:
* Setting the values of input objects from the server

This is an interesting and useful feature to develop, for instance, "converters" as the example below.
http://albertosantini.github.io/examples/mvc/temperatureExample3.html

Thanks,
Alberto

Re: Setting inputs from the server Winston Chang 4/11/13 10:58 AM
Yes, it should make this kind of functionality easier and more elegant to implement. It was already possible to "set" an input by sending a dynamic UI object (which replaces the original), but the new method is much cleaner. Instead of replacing the UI, it just tells the UI object to change values.




--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: Setting inputs from the server Dieter Menne 4/15/13 9:27 AM
This is great news, Winston, it make editable field usable at last, and enabling/disabling of button easier.

There is one minor problem in the example posted on gist (forgot how I get access to glimmer, but feel free to do so). It's described in the application window.


A revised and much better
version of

https://gist.github.com/dmenne/4721235

is available now on

https://gist.github.com/dmenne/5389291

Requires developer version 0.5 of Shiny


devtools::install_github('shiny', 'wch', 'set-input')

To run

runGist("https://gist.github.com/dmenne/5389291")

Re: Setting inputs from the server Mike C 4/15/13 10:30 AM
This is fantastic.  I really like the direction this is going in, my only regret is that I am almost finished my app the old fashioned way! :)

One quick question, can isolate and action buttons be applied to the session observations? ie:

observe({
if(input$goButtonx<1)
return() #make it NULL initially
input$goButtonx
x <- isolate(input$controller)#only update x each time the goButtonx is pressed

 updateTextInput(session, "inText", value = paste("New text", x)) #only updates when goButtonx is pressed
})
Re: Setting inputs from the server Mike C 4/16/13 6:45 AM
Sorry for following up with another question before the first was answered, but I noticed that the setup still seemed 'hard coded' in terms of how many options were available for each field (in this example, usually 2 options in drop down menus and radial buttons).  Is it dynamicUI still the tool to use to get a variable number of inputs in a given field?
Re: Setting inputs from the server Winston Chang 4/16/13 8:33 AM
You should be able to add as many options as you want. In the demo, I just put two options for each group because it was simpler to code.

-Winston


--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: Setting inputs from the server Winston Chang 4/16/13 8:35 AM
This should work - the updaters work just like any other functions.


--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: Setting inputs from the server Winston Chang 4/16/13 8:45 AM
Very nice. We're also looking at adding the capability for sending arbitrary JSON messages to the client; and then on the client, making it easy to add callbacks that will receive the JSON message.

In your app, instead of sending an entire Javascript command, you could send a message which would be passed to a function on the client, which would enable/disable the appropriate item.

-Winston




--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: Setting inputs from the server Paul Rigor 6/28/13 11:22 AM
Just wanted to follow up on whether the changes discussed in this thread have made it to the main branch?

Thanks!
Paul
Re: Setting inputs from the server Yuan Yuan 6/28/13 11:55 AM
This is very cool! Thanks, Winston and the team.
Re: Setting inputs from the server Winston Chang 6/28/13 12:09 PM
Hi Paul - yes, the changes are in Shiny 0.6.0. Here's a demo:
-Winston