-
-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
updating child components via a parent method #666
Comments
Hi, I can confirm that I am also witnessing the behaviour you've described. I would also highlight an even simpler case taken from the example in the documentation. It seems that setting the value of children from the parent doesn't produce the desired effect: def load_table(self):
self.books = Book.objects.all()
for child in self.children:
if hasattr(child, "is_editing"):
child.is_editing = True # This is not having any effect whatsoever |
@adamghill this issue was raised in priority for me so I started to revisit it last week, and I believe I found the issue. The bug looks to be coming from the caching process. Using my
|
EDIT: this unfortunately isn't the solution. see comments below Here's my guess at a quick fix. You can add the line # method added to TableView
def begin_edit_all(self):
for child in self.children:
if hasattr(child, "is_editing"):
print("child set to editting")
child.is_editing = True
self._cache_component() # BUG-FIX |
another update -- the fix looks to be more involved because children data isn't updated in the frontend js (even even if it shows correct data in the html). So when the next message is sent to the backend, old |
Branching from #662
I have a question about going one step beyond your example in the docs -- Can
force_render
be applied to a list of children components? I'm struggling to get this to work as expected. For example say I add the following method & html to thetable
component:My attempts to
force_render
child components fail. And as a more complex example, using filter + begin_edit_all applies to all books rather than those that have been filtered:Here are the files for this example:
mysite_example3.zip
A more realistic example of this would involve a table where you want to apply a status to all child components. For example, we could have a list of tasks that are filtered down and then you apply a
set_status_complete
to these filters items - that updates the table + status column.The text was updated successfully, but these errors were encountered: