Returns a dictionary of all the Input props that changed and caused the callback to execute. It is empty when the callback is called on initial load, unless an Input prop got its value from another initial callback. Callbacks triggered by user actions typically have one item
(self)
| 87 | @property |
| 88 | @has_context |
| 89 | def triggered_prop_ids(self): |
| 90 | """ |
| 91 | Returns a dictionary of all the Input props that changed and caused the callback to execute. It is empty when |
| 92 | the callback is called on initial load, unless an Input prop got its value from another initial callback. |
| 93 | Callbacks triggered by user actions typically have one item in triggered, unless the same action changes |
| 94 | two props at once or the callback has several Input props that are all modified by another callback based |
| 95 | on a single user action. |
| 96 | |
| 97 | triggered_prop_ids (dict): |
| 98 | - keys (str) : the triggered "prop_id" composed of "component_id.component_property" |
| 99 | - values (str or dict): the id of the component that triggered the callback. Will be the dict id for pattern matching callbacks |
| 100 | |
| 101 | Example - regular callback |
| 102 | {"btn-1.n_clicks": "btn-1"} |
| 103 | |
| 104 | Example - pattern matching callbacks: |
| 105 | {'{"index":0,"type":"filter-dropdown"}.value': {"index":0,"type":"filter-dropdown"}} |
| 106 | |
| 107 | Example usage: |
| 108 | `if "btn-1.n_clicks" in ctx.triggered_prop_ids: |
| 109 | do_something()` |
| 110 | """ |
| 111 | triggered = getattr(_get_context_value(), "triggered_inputs", []) |
| 112 | ids = AttributeDict({}) |
| 113 | for item in triggered: |
| 114 | component_id, _, _ = item["prop_id"].rpartition(".") |
| 115 | ids[item["prop_id"]] = component_id |
| 116 | if component_id.startswith("{"): |
| 117 | ids[item["prop_id"]] = AttributeDict(json.loads(component_id)) |
| 118 | return ids |
| 119 | |
| 120 | @property |
| 121 | @has_context |
nothing calls this directly
no test coverage detected