How can I run the json editor in a read only mode from the start? #3047
-
QuestionMy goal is to render the ui.json_editor in read only mode from the start, but I struggle to achieve this. Below is my code:
Any help on how can I achieve my goal would be highly appreciated. Thanks in advance for your help with this. from pprint import pprint
from nicegui import ui
editor = ui.json_editor(
{'content': {'json': current_execution_to_add}},
{'context':{'readOnly': True}}
)
ui.button('Readonly', on_click=lambda: editor.run_editor_method('updateProps', {'readOnly': True}))
ui.button('print', on_click=lambda: pprint(editor.__dict__)) |
Beta Was this translation helpful? Give feedback.
Answered by
falkoschindler
May 10, 2024
Replies: 1 comment 1 reply
-
Hi @sabinem, This seems to work: ui.json_editor({
'content': {'json': {'A': 1, 'B': 2}},
'readOnly': True,
}) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
sabinem
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @sabinem,
This seems to work: