Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
protogrid:script_library [2017-12-15 09:47] – 46.140.51.3 | protogrid:script_library [2021-01-22 14:50] – [Execute JS on field change] dru | ||
---|---|---|---|
Line 6: | Line 6: | ||
Server-ScriptLibraries contain code happening at the server before sending the data to the client. Every [[protogrid: | Server-ScriptLibraries contain code happening at the server before sending the data to the client. Every [[protogrid: | ||
- | == on_render == | + | ==== on_render |
on_render gets called when opening a new Card. This function can be used for example to [[protogrid: | on_render gets called when opening a new Card. This function can be used for example to [[protogrid: | ||
<code javascript> | <code javascript> | ||
Line 39: | Line 39: | ||
</ | </ | ||
- | ===== Client ScriptLibrary ===== | + | ===== Client-ScriptLibrary ===== |
The client-side script library contains all the code happening locally on the clients machine. This contains all the code executed when [[protogrid: | The client-side script library contains all the code happening locally on the clients machine. This contains all the code executed when [[protogrid: | ||
Line 51: | Line 51: | ||
on_load(); | on_load(); | ||
function on_load() { | function on_load() { | ||
- | //do something useful | + | |
+ | | ||
} | } | ||
</ | </ | ||
Line 78: | Line 79: | ||
The function document_ready_trigger tells your card that you want something to happen when a value changes. The call " | The function document_ready_trigger tells your card that you want something to happen when a value changes. The call " | ||
+ | |||
+ | ==== Manipulate Contet of Rich Text Field ==== | ||
+ | |||
+ | <code javascript> | ||
+ | var rich_text_editor = $("#" | ||
+ | |||
+ | var content = rich_text_editor.getDocument().toString(); | ||
+ | rich_text_editor.setSelectedRange([0, | ||
+ | rich_text_editor.setSelectedRange([0, | ||
+ | var current_range = rich_text_editor.getSelectedRange(); | ||
+ | rich_text_editor.insertString(" | ||
+ | rich_text_editor.insertHTML("< | ||
+ | rich_text_editor.insertLineBreak(); | ||
+ | rich_text_editor.deleteInDirection(" | ||
+ | rich_text_editor.activateAttribute(" | ||
+ | rich_text_editor.deactivateAttribute(" | ||
+ | </ | ||
+ | |||
+ | Please see https:// |