[Seaside] CSS style not applied until reload
Mortensen Sigrid E.
sigrid at selfhelpsoftware.com
Tue Apr 13 20:56:28 UTC 2010
Okay, well... I have a follow-up question.
It turns out that the problem is not so much that the children are being added dynamically, as it is that the component the children are in is being added to the page via an SUUpdater. When an anchor is clicked, I'm using the updater to redisplay only the portion of the page that has that component.
Is there any way to update the style when this happens? I've looked at #updateRoot: but it's not clear how I could call that or where I could find the root to pass as a parameter.
(I know, I know... external style sheet. I'm starting to lean in that direction, but I'm reluctant. I realize it's more efficient, but I'm a Smalltalker who goes way back, and I like the idea of each component having its own #style method. Good encapsulation, and all that....)
Here are some code snippets:
The render method with the anchor:
renderTableDataFor: reportName on: html
"Render one cell of the table, showing reportName as a clickable anchor. When the user clicks on the anchor, trigger an updater which will then tell the PWReportView to update and re-render its parameterForm."
id: reportView parameterFormDivID; "the id of the div that will be updated"
callback: [:renderer |
reportView renderSelectedReport: reportName on: renderer
PWReportView>>renderSelectedReport: reportName on: renderer
"The user selected a report by clicking on an anchor that is the name of the type of the report. Inform the parameterForm of the name of the selected report so the parameterForm can display the parameters that will allow the user to further specify the report to be run. Also, since this was triggered via an updater, re-render the parameterForm only (not the entire window)."
parameterForm reportName: reportName.
renderer render: parameterForm.
"The user has clicked on a report name in the list of reports that can be run. In order to allow the user to further parameterize the report before it is run, create a new parametersEditor to display, based on the report name."
reportName := aReportName.
parameterEditor := PWReportParametersEditor new: reportName. "This creates the editor and initializes its children; prior to this the parameterEditor was a PWReportParametersEditor with no children."
On Apr 12, 2010, at 7:00 PM, Mortensen Sigrid E. wrote:
> Never mind. (I knew as soon as I sent the message I'd figure it out!)
> It has to do with how I'm dynamically adding child components to the parent component. At the time the #style method is called, the child I've added isn't in the children collection, so the #style method isn't called for that child. Then I add the component, and it's in the collection, but the style method isn't called again until I refresh the page.
> -- S.
> On Apr 12, 2010, at 6:50 PM, Mortensen Sigrid E. wrote:
>> Hi All,
>> Any idea why a style would not be applied to a component until the page is reloaded?
>> When I first click on an anchor that shows the component, the style is not applied. If I click the reload button on the browser, the style shows up. It was impossible to figure out what was going on by toggling halos, because that reloads the page, but I can see it clearly in Firebug. When the component is first rendered, firebug shows no style directly associated with that component (it only shows a style inherited from the containing div), but if I reload the page, it's there.
>> This is on a div that's buried deep within another div, in a form, in a div, etc., in td in a tr of a tbody, etc.
>> I am using #style methods, which I realize is no longer the recommended procedure, but it has always worked up until now.
>> Thanks in advance for any insights.
>> -- Sigrid.
>> seaside mailing list
>> seaside at lists.squeakfoundation.org
> seaside mailing list
> seaside at lists.squeakfoundation.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the seaside