node-red / node-red/node-red.github.io
Creating your own Node - where to add TypedInput on('change') event handlers
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- JavaScript
- Estrellas
- 118
- Forks
- 161
- Merge medio
- 8 h 18 min
- PR fusionados (30 d)
- 4
Descripción
This issue is to suggest a couple of areas where documentation could be improved. Documentation is otherwise very good.
I haven't been able to find documentation for when in time to add a function to watch for change events as documented here. For example, to show/hide or enable/disable an HTML element based on a value of one of the Node properties.
Adding this within oneditprepare does not work ...
$('#node-input-instruction').on('change', (event, type, value) => {
if (value === 'turn_on') {
$('#node-wrapper-speed').typedInput('enable');
$('#node-wrapper-timeout').typedInput('enable');
} else if (value === 'turn_off') {
$('#node-wrapper-speed').typedInput('disable');
$('#node-wrapper-timeout').typedInput('disable');
}
});
... because you get an error since you can't call the typedInput function this early. Is there an official/recommended callback we should be using for once the UI has been setup (added to the DOM, or whaterver work you do)? In the meantime, I am setting hide/show directly on various elements, rather than using typedInput().
Can the documentation in Node Properties and/or TypedInput Widget be updated to make this easier to understand, to provide examples of method calls? Or maybe I've just missed something in the documentation.
If I am confused, maybe others are as well (or maybe they are better at reading documentation).
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Revisa docs/creating-nodes/properties.md en “Custom edit behavior” y docs/api/ui/typedInput/index.md alrededor de “Methods” y “Disable state”. Compara el momento del change-event de TypedInput documentado con el ejemplo de oneditprepare del issue. Se considera completado cuando la documentación explica cuándo pueden los handlers llamar a los métodos de TypedInput e incluye un ejemplo funcional.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- javascript
- Área
- documentation
- Tipo de issue
- Documentación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 42/100