[Seaside] Add button not showing it's page

Julian Fitzell julian at beta4.com
Mon Jul 26 22:42:40 CEST 2004


Hi s002,

Say, do you have a name? :)

So the problem below is that you are using a render method as your 
callback, which is not at all what you want to do.

Every time a request comes in, the callbacks are executed and then the 
root component is obtained and asked to render itself to be displayed to 
the user.  Your callback needs to perform some action to cause the 
display state to change before the next render pass is executed.

When you call #renderAddOn: in your callback, nothing changes that would 
cause PMLogsView to render itself any differently than the last time, 
which is why you see the same page drawn again.

What you probably want to do here is have another component, say 
PMLogItemEditor, which you pass a new instance of PMLogItem into.  For 
example you could write an action method like:

addNewItem
    |item|
    item := PMLogItem new.
    "store the item however you do that"
    self call: (self editorComponentFor: item)

And then in your render method use:

html anchorWithAction: [self addNewItem] text: 'Add'

Obviously you'd have to implement a #children method as well as 
#editorComponentFor: to keep track of the editor component...

Julian

s002 wrote:
> I have an object that shows a record from a GOODS database.  I created a 
> link to 'add' a new record.  When I click on the link, the screen 
> flashes and stays  at the recordlist page.  Can someone help me.
> PMLogsView>>renderContentOn: html
>     | |
>     html table: [
>         html tableRow: [html tableHeading: 'View all Log Entries'; 
> space; space; space.
>             html tableData: [html anchorWithAction: [self renderAddOn: 
> html] text: 'Add']]].
>     html attributeAt: 'cellspacing' put: 0; attributeAt: 'cellpadding' 
> put: 5; attributeAt: 'border' put: 2.
>     html table: [
>             allRecords do: [:i |
>                 html tableRow: [
>                     html tableData: [html anchorWithAction: [self 
> delete: i from: db] text: 'Del'].
>                     html tableData: i type.
>                     html tableData: i entryDate.
>                     html tableData: i startTime.
>                     html tableData: i entryText.
>                     html tableData: i endTime.
>             ].
>         ].
>         html tableRow: []
> ]
> ------
> and here is the
> PMLogsView>>renderAddOn: html
> " show add new log form"
>     aRecord := PMLogItem new.
>     aRecord initialize.
>     html form: [
>     html table: [
>         html tableRow: [html tableHeading: 'New Log Entry']].
>     html text: 'TEST NEW ENTRY PAGE'.
>     html text: aRecord entryDate.]
>     
> _______________________________________________
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/listinfo/seaside


More information about the Seaside mailing list