Sfoglia il codice sorgente

Update .getValue() - number of characters entered

shiny-input
Garrick Aden-Buie 6 anni fa
parent
commit
b3958d5e3f
2 ha cambiato i file con 11 aggiunte e 1 eliminazioni
  1. +10
    -0
      inst/shiny-input-app/dev-shiny-input.Rmd
  2. +1
    -1
      inst/shiny-input-app/typing.js

+ 10
- 0
inst/shiny-input-app/dev-shiny-input.Rmd Vedi File

## Setup our input binding ## Setup our input binding


Now it's time to setup our input binding. Replace `FIXME` with `el.value`. Now it's time to setup our input binding. Replace `FIXME` with `el.value`.
(`r github_sha_link("85205fbcbb93ccb506558e62f73a8f0d6a88c83c")`)

### Your Turn

The `.value` of a `textarea` element
is a string containing the text inside the element.

Update `.getValue()` to

1. Return the number of characters the user has typed

+ 1
- 1
inst/shiny-input-app/typing.js Vedi File

// your input. In this function, find or construct the value that will be // your input. In this function, find or construct the value that will be
// returned to Shiny. The ID of `el` is used for the inputId. // returned to Shiny. The ID of `el` is used for the inputId.


return el.value;
return el.value.length;
}, },
setValue: function(el, value) { setValue: function(el, value) {
// This method is used for restoring the bookmarked state of your input // This method is used for restoring the bookmarked state of your input

Loading…
Annulla
Salva