[Seaside] Checkbox and AJAX?

Mariano Martinez Peck marianopeck at gmail.com
Fri Dec 20 21:15:15 UTC 2013


On Fri, Dec 20, 2013 at 5:36 PM, Johan Brichau <johan at inceptive.be> wrote:

> Hi Mariano,
>
> This should do the trick:
>
> html checkbox
>         value: aValue;
>         callback: [:boolean |  ... ];
>         onClick: (html jQuery ajax serializeThisWithHidden).
>
>
hahah that easy?? Thanks Johan! it seems the key point was the hidden part
because I tried many things without that and it didn't work.

Now, a last question. In my case, I want to re-render the whole
table/containter after the ajax because selected rows have a special color
(css class)....I know which is the ID of my tableContainer. I also have
access to the component I would like to re-render (self report). I tried a
few things like this:

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).

Any idea?





> cheers
> Johan
>
> On 20 Dec 2013, at 21:27, Mariano Martinez Peck <marianopeck at gmail.com>
> wrote:
>
> > Hi guys,
> >
> > I have this piece of seaside that renders a checkbox:
> >
> > renderCellFormContent: anObject on: html
> >
> >       html form: [
> >               html label:[
> >                       html checkbox
> >                               submitOnClick;
> >                               value: (self isSelected: anObject);
> >                               callback: [ :value | self selectRow:
> anObject value: value ]]]
> >
> > That checkbox is actually one table cell of a row of a table (the first
> column) to select/unselect items. I would like to make this checkbox go
> with an AJAX request so that the whole page is not rendered and hence I
> loose scroll position etc....
> >
> > So..what I need is that in the onClick of the checkbox I send an AJAX
> request. The checkbox of course should be updated and I also need to be
> able to continue executing the callback and the value.
> >
> > Any idea how can I do this in Seaside?
> >
> > Thanks in advance,
> >
> > --
> > Mariano
> > http://marianopeck.wordpress.com
> > _______________________________________________
> > seaside mailing list
> > seaside at lists.squeakfoundation.org
> > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>



-- 
Mariano
http://marianopeck.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20131220/2c4e6653/attachment.htm


More information about the seaside mailing list