I am building a table in Seaside (Using VisualAge Smalltalk). I would like to have each table row have an image as well as text data. This what the method looks like:
where PSIni getImageUrl
returns the main part of the url
. The final url
looks like http://www.totallyobjects.com/images/pennstadt//15.jpg
Can anyone point me as to how to get this done please?
makeData: html usingMethod: aMethod
|tableData headingList methodList|
tableData := self perform: aMethod.
headingList := self headingList.
methodList := self methodList.
html table: [
html tableRow: [
headingList do: [ :each | html
tableHeading: each
]
].
tableData do: [ :one |
html tableRow: [
methodList do: [ :each |
each = #image ifTrue: [
html tableData: (self showImageFor: one id using: html)
] ifFalse: [
html tableData: (one perform: each)
]
]
]
]
]
(self showImageFor: one id using: html)
obviously doesn't work. This method looks like this:
showImageFor: anID using: html
html image width: 200; url: PSIni getImageURL, '/', anID printString, '.jpg'
where PSIni getImageUrl
returns the main part of the url
.
The final url
looks like: http://www.totallyobjects.com/images/pennstadt/15.jpg and should result in that image appearing in one element of a table row.
You need to nest the brushes:
html tableData: [ (self showImageFor: one id using: html) ]
It's explained in depth in the book: http://book.seaside.st/book/fundamentals/rendering-components
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.