[Seaside] Changes in GOODS not showing in browser

C. David Shaffer cdshaffer at acm.org
Fri Jul 30 18:04:30 CEST 2004


I suspect that the problem is the "allRecords" instance variable in 
PMLogsView.  Where does that get filled in?  You will have to refresh it 
each time you render the component.  An alternative is to have your 
database connection stored in your Seaside session.  Then you only have 
to worry about flushing that view periodically so you see other 
session's changes to the database.  The tutorial Avi mentioned shows you 
how to do this.

David



LK wrote:

> Thanks for all the support.  You guys are the greatest!  I now have an 
> app that will add and delete records from a GOODS database.  My 
> problem now is they added records are  not showing  in the PMLogsView 
> when I refresh my browser.  The user must close and re-open the 
> browser to see the changes.  Is there a way to fix this?
>
> -Larry
>
>
> Relevent code is below:
>
> PMLogsTask>>renderContentOn:  html
>
>    |db |
>    html cssId: 'banner'.
>    html table: [
>        html tableRowWith: [
>            html divNamed: 'title' with: self title.
>            html divNamed: 'subtitle' with: self subtitle.
>        ]
>    ].
>    html render: pmLogsView.
>    html text: 'testing'.
>
> -----
> PMLogsView>>renderContentOn: html
>    | |
>    html table: [
>        html tableRow: [html tableHeading: 'View all Log Entries'; 
> space; space; space.]].
>    html anchorWithAction: [self call: PMLogAddItem new] 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: []
> ]
> -----------
> PMLogAddItem>>renderContentOn: html
> " show add new log form"
>    item := PMLogItem new.
>    item initialize.
>    html form: [
>        html table: [
>            html tableRow: [html tableHeading: 'New Log Entry'].
>            html tableRow: [html tableData: 'Date'. html tableData: 
> item entryDate].
>            html tableRow: [html tableData: 'Time'. html tableData: 
> item startTime].
>            html tableRow: [html tableData: 'Type'. html tableData: 
> [html selectFromList: #('DRE' 'SA' 'DBA' 'TEST') selected: (item type) 
> callback: [:i | item type: i]]].
>            html tableRow: [html tableData: 'Entry Text'. html 
> tableData: [ html textAreaWithValue: 'log entry' callback: [:i| item  
> entryText: i]]].
>        ].
>        html submitButtonWithAction: [self add: item] text: 'Save'.
>    ]
>      ---------
> PMLogAddItem>>add: aRecord
>    db _ PMDatabase new connect.
>    self table: (db root at: 'logs').
>    table add: aRecord.
>    db commit.
>    db flush.
>    db logout.
>    self answer.
> -----
>
> _______________________________________________
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/listinfo/seaside




More information about the Seaside mailing list