R: submitButton and conditionalPanel - r

I've got a UI that is entirely build with conditional panels. But the problem I am having now is that I need a submit button. When introducing the submit button, it will render all the conditional UI to not show up conditionally unless I press the submit button.
My question is if there is a way so that the conditional display of various UI sliders, input, etc be not dependent on the submit button?
Thanks,

I had this problem when I was using the submit button to crunch data intensive code that was dependent on the widgets I programmed on the reactive interface. As soon as I added a submit button, all reactive widgets became static until i pressed the submit button (which was a pain because I had a reactive plot on the main panel). Thanks to the wonderful Mr. Cheng, I found out that you cannot (yet) make individual widgets dependent on a submit button. It is an all or nothing kind of deal. Therefore it may better to use an 'actionButton', sandwiched between the 'observe' and 'isolate' functions. It may look something like this..
observe({
if (input$action_button == 0) # tells action button to do nothing when not clicked ..
return()
isolate({ # this isolates the code you want to execute when clicking the action button..
###some function or conditional panel###
})})
Hopefully this works for you. It did for me :)

Related

In R shiny, a dropdown widget shows itself when it is updated

I can't produce an example because the code is pretty large and complex.
But there is a selectInput widget that is hidden, via shinyjs::hide. But when I call the updateSelectInput function to change the values of this widget, it shows itself.
Has anyone encountered a situation like this? Just by merely updating the widget should not cause it to reappear.

Woocommerce Order admin / edit page - how to trigger totals recalculation via JS upon order change?

Is there a way to trigger this recalculation upon change?
It can be done manually by clicking the button at the bottom of the order items rows, but can a change in the order be detected on the client side?
Thanks
There's always the .trigger() function:
$('button.calculate-action').trigger('click');
Unfortunately, this button pops a confirmation dialog that, to my knowledge, can't be forced to click 'Yes' or skipped in some way. The function called by clicking the Recalculate button is meta-boxes-order-items.recalculate(), which is tucked away in the meta-boxes-order.js file within a private variable. If possible we could just call that function directly, but alas, this isn't possible ( unless someone else knows... )
Perhaps clicking the Save button will help accomplish your goal?
$('button.save-action').trigger('click');

Unity3D: How to programmatically test new UI features

I have an app built in Unity which uses the new canvas features including buttons and inputfields.
I'm wondering how I could implement automated testing by programmatically entering characters into the input fields and clicking buttons.
In the case of the button the UI.Button component doesnt seem to have a click method you can call.
Is there a way of registering mouse clicks at the buttons location? Or some other way of achieving this?
Ok, This is how you click a button programmatically
MyButton.onClick.Invoke();
and for the inputfields you can just set their text fields like so..
MyInput.text = "flooopybloopybloo";

R Shiny How make a help box appear with an action button

I have created an action button as follows in my ui
div(style="display:inline-block",actionButton("action", label = "Help"))
I want this button to create a help box which the user can close which contains text on how to use this app. How do i do this?
Also, how do I customise this button? such as font, colour, alignment...
Thanks
Clicking the action button increments a value, initially 0. You could use renderUI in your server.R file to define a widget that is empty when input$action is even, and helpText when it is odd. That way, the same action button would both open and close the help.
output$HelpBox = renderUI({
if (input$action %% 2){
helpText("Here is some help for you")
} else {
return()
}
})
In ui.R, use the uiOutput function to display the widget. Remember that it will display nothing until the action button is clicked.
uiOutput("HelpBox")

Users are Mad! Wijmo Grid AfterCellUpdate not triggering

I have a editable wijmo grid that works pretty good but there is a problem that continues to stump me and makes users upset.
When you double click to edit a cell, after it's been edited, the AfterCellUpdate (AfterCellEdit or any other) event is never triggered if you click anywhere on the page that is outside of the actual grid; events do fire if you click inside the grid.
This has proved to be rather inconvenient since I need to process the underlying data every time cell data is changed and it is common for a user to double click, edit the data, and then click the save button without clicking inside the grid (and it makes sense to me that they should be able to do that).
Of course, the data doesn't get saved because it doesn't appear to have been changed in the data source; this doesn't make them happy :-)
It does save the data properly if they click in the grid and then click save.
Can someone PLEASE shed some light into this rather perplexing issue???
BTW, I saw similar behavior in some of the sample code that comes with the product; I mean when editing if I clicked outside the grid it stays in edit mode on the cell being edited.
Wijmo grid saves the data when the current cell changes. To save data on clicking the save button without having to click inside the grid, you could call the endEdit method of the grid on the save button click.
$("#btnSave").click(function(){
$("#grid").wijgrid("endEdit");
});

Resources