On Jul 31, 4:27 pm, Ken Snyder <[EMAIL PROTECTED]> wrote:
> jenner wrote:
> > ...
> > What I'd like to do is - create the nice visual effect as defined in
> > switchPositionsWithMove(), but
> > reorder the DOM structure as in switchPositionsWithDOM(). Ideas
> > anyone?
>
> > TIA,
> > jenner
>
> You _could_ call switchPositionsWithDOM() inside of
> switchPositionsWithMove(), but why on earth would you need the DOM order
> a certain way?  DOM order is somewhat like an object properties--the
> object {a: 'first', b: 'second'} is effectively the same as {b:
> 'second', a: 'first'}.  Maybe I'm missing something.

Actually, I'm just being lazy here - the DOM order is responsible for
the correct list member ordering (those DIVs contain form elements).
So after I've swapped the DIVs I'm "reindexing" all contained form
elements depending on their DOM order (s.th. like
container.getElementsBySelector('div.containing-divs-
class').each(<reassign indices for form elements here>); see [1]).
I mean, sure, I could take care of those indices manually, but that
seems to be quite error prone, since I also can add and remove new
DIVs on the fly...

Cheers,
jenner

[1]: that's for a spring MVC app, where you can bind to your form
objects' Collection properties by referencing them through an array
index, like <input type="text"
name="formObject.myListProp[$index].someStringProp" />. The $index
part is the one I need to recalculate each time I'm swapping the DIVs
(i.e. moving a DIV up or down)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to