Przeglądaj źródła

Update .getValue() - return both as object/list

shiny-input
Garrick Aden-Buie 6 lat temu
rodzic
commit
edfb9399ea
2 zmienionych plików z 8 dodań i 2 usunięć
  1. +4
    -1
      inst/shiny-input-app/dev-shiny-input.Rmd
  2. +4
    -1
      inst/shiny-input-app/typing.js

+ 4
- 1
inst/shiny-input-app/dev-shiny-input.Rmd Wyświetl plik



1. Return the number of characters the user has typed (`r github_sha_link("b3958d5e3f60fbac3a0100673696bd413a276fb4")`) 1. Return the number of characters the user has typed (`r github_sha_link("b3958d5e3f60fbac3a0100673696bd413a276fb4")`)


1. Return the number of words the user has entered
1. Return the number of words the user has entered (`r github_sha_link("e3fa485bb60853e391302289213d3cd5f0846b3e")`)

1. Create variables for both number of characters and words and return both
in an object

+ 4
- 1
inst/shiny-input-app/typing.js Wyświetl plik

// 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.split(' ').length;
const nchar = el.value.length;
const nword = el.value.split(' ').length;

return {nchar, nword};
}, },
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

Ładowanie…
Anuluj
Zapisz