Hello,
I'm using Seaside 2.9, Squeak and the new Seaside JQuery support. I'm creating a table where each row has a checkbox, just like GMail I want to provide a "Select all" and a 'Select none" link. My idea is to use JQuery to select or unselect all checkboxes: html anchor onClick: ((html jQuery expression: ':checkbox') value: 'checked'); with: 'All, '. The problem is that this adds the value="check" attribute to all checkbox elements but I need the checked="checked" attribute! I also tried: html anchor onClick: ((html jQuery expression: ':checkbox') do: [ :each | each click ]); with: 'All, '. But this doesn't work because the JQueryInstance object has no click method. Can anyone help me out? Jan. _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Hello,
I think I found the solution: html div: [ html text: 'Select: '. html anchor onClick: ((html jQuery expression: ':checkbox:not(:checked)') trigger: 'click' ); with: 'All, '. html anchor onClick: ((html jQuery expression: ':checkbox:checked') trigger: 'click' ); with: 'None' ]. This works perfectly :-) Jan. On Fri, Dec 12, 2008 at 2:53 PM, Jan van de Sandt <[hidden email]> wrote: Hello, _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Have a look at the JQuery documentation:
http://docs.jquery.com/Attributes/val#val.28.C2.A0val_.29_2 I agree that the way the #value: thing works is a bit strange (you have to assign IDs to the checkbox and specify those in the argument). There is nothing we can do about that in Seaside though, report it in the JQuery bug tracker if you think that this should be changed. I suggest to use #attributeAt:put:. This works without problems and is relatively simple: (html jQuery: ':checkbox') attributeAt: 'checkbox' put: true Cheers, Lukas On Fri, Dec 12, 2008 at 3:15 PM, Jan van de Sandt <[hidden email]> wrote: > Hello, > > I think I found the solution: > > html div: [ > html text: 'Select: '. > html anchor > onClick: ((html jQuery expression: ':checkbox:not(:checked)') > trigger: 'click' ); > with: 'All, '. > html anchor > onClick: ((html jQuery expression: ':checkbox:checked') trigger: > 'click' ); > with: 'None' ]. > > This works perfectly :-) > > Jan. > > > On Fri, Dec 12, 2008 at 2:53 PM, Jan van de Sandt <[hidden email]> > wrote: >> >> Hello, >> >> I'm using Seaside 2.9, Squeak and the new Seaside JQuery support. I'm >> creating a table where each row has a checkbox, just like GMail I want to >> provide a "Select all" and a 'Select none" link. >> >> My idea is to use JQuery to select or unselect all checkboxes: >> >> html anchor >> onClick: ((html jQuery expression: ':checkbox') value: 'checked'); >> with: 'All, '. >> >> The problem is that this adds the value="check" attribute to all checkbox >> elements but I need the checked="checked" attribute! >> >> I also tried: >> >> html anchor >> onClick: ((html jQuery expression: ':checkbox') do: [ :each | each >> click ]); >> with: 'All, '. >> >> But this doesn't work because the JQueryInstance object has no click >> method. >> >> Can anyone help me out? >> >> Jan. > > > _______________________________________________ > seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside > > -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
> (html jQuery: ':checkbox') attributeAt: 'checkbox' put: true
Sorry, this should work better ... (html jQuery: ':checkbox') attributeAt: 'checked' put: true Lukas -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Hello Lukas,
Yes, the "attributeAt: 'checked' put: true" approach also works. Now I have two ways to make it work. Thank you! Jan. On Fri, Dec 12, 2008 at 3:43 PM, Lukas Renggli <[hidden email]> wrote:
_______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Free forum by Nabble | Edit this page |