strategy -
1. we have a table with rows
2. we know that the last row has an input with the counter we are looking
for
3. we fetch that input
4. we parse it's name to fetch the right counter (easiest way is regex), and
set it, then initialize the event

so it should look something like this:

//on domready, we fetch the table. then:
var input = table.getElement('tr:last-child input');
    , counter = +(input.get('name').match(//item\[([0-9]+)/)[1]);

//add the event.


as a side note - for me, whever I find that I require to automate complex
behavior and attach it to an element, I wrap it in a class, instead of
putting it in the domready. this will make it much easier to maintain and
extend later on.

On Mon, Dec 20, 2010 at 9:55 AM, lidgold <[email protected]> wrote:

> Hi Arieh,
> thank you for you reply.
> The problem with the counter is that I do not start from 0 everytime. I
> could have one, two, three or even more rows populated yet.
> So I should be able to get the last row item number and start counting from
> it.
>
> Really don't know how to do it.
> Any idea?
>
> Thank you
>



-- 
Arieh Glazer
אריה גלזר
052-5348-561
http://www.arieh.co.il
http://www.link-wd.co.il

Reply via email to