[Seaside] Checkbox and AJAX?
Bob Arning
arning315 at comcast.net
Fri Dec 20 21:32:30 UTC 2013
You *can* re-render just a row or even just a cell. I use the following
to re-render a single cell:
s1 _ html jQuery ajax
callback: [ :value |
value = 'undefined' ifTrue: [
lastCellIndex _ nil.
] ifFalse: [
lastCellIndex _ value.
showing at: lastCellIndex put: (showing at:
lastCellIndex ifAbsent: [false]) not.
].
]
value: (((html jQuery: '.',idForExpandableSource) filter:
'return(bobclicktest(this))' asFunction) first attributeAt: 'id');
script: [ :s |
lastCellIndex ifNotNil: [
self updateHistory.
s << ((s jQuery: lastCellIndex asSymbol) html: [ :h |
cellInfo _ (idsToCells at: lastCellIndex) third.
(showing at: lastCellIndex) ifTrue: [
toShow _ String streamContents: [ :strm |
cellInfo sourceArray do: [ :e |
strm
nextPutAll: e first asString;
nextPutAll: '>>';
nextPutAll: e second asString;
cr;
nextPutAll: e third asString;
cr; cr
]
].
h text: '[x]'; break.
h textArea columns: 50; rows: 20; style:
'text-align: left'; value: toShow.
] ifFalse: [
h text: cellInfo byteCount asString
].
]).
].
].
You can see this in action at http://69.251.218.6:9116/time if you click
on a cell with something in it.
Cheers,
Bob
jQuery: '#tableContainer'
On 12/20/13 4:15 PM, Mariano Martinez Peck wrote:
> renderCellFormContent: anObject on: html
>
> html form: [
> html label:[
> html checkbox
> value: (self isSelected: anObject);
> onClick: (html jQuery ajax
> serializeThisWithHidden;
> html: [ :renderer | self halt. renderer render: self report ]
> "onSuccess: ((html jQuery: '#tableContainer') load)");
> callback: [ :value | self selectRow: anObject value: value ]]]
> But none worked. I am still newbie with Ajax stuff so I am probably
> doing something wrong.
> BTW, if I can only refresh the row, cool, but as far as I know that's
> not possible (or complex?). So just rendering the table again I think
> it would be ok (unless I loose scroll position).
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20131220/1800a9dd/attachment-0001.htm
More information about the seaside
mailing list