[jQuery] Re: Design question

2008-11-24 Thread Michael Geary
Is row_position a row number in the table? Those numbers would change when you delete a row. Or is it a value that you increment every time you add a row (independent of the position in the table)? That would work - but you wouldn't have a way to loop through this object sequentially. Dave, I thi

[jQuery] Re: Design question

2008-11-24 Thread Nicolas R
instead of using an array you could use a key/value object. then you can do something like var o = {} o[row_position] = [row_data] then when you remove a row you do delete o[row_position] you could get the row's position from the drag&drop callback I assume, but even if thats not the case its

[jQuery] Re: Design question.

2008-02-10 Thread J Moore
hey shawn, this is an old thread, but i have another option for you: closures. jquery is all about closures, but i only recently fully "got" how they worked and how cool they can be. In the case of a table of results, where each row has a button, closures avoids the ugliness of parsing the dom

[jQuery] Re: Design question.

2008-01-19 Thread Shawn
hmmm... jQuery.data looks promising. I'll check it out. Thanks for the tip. Shawn polyrhythmic wrote: > Hello Shawn, > > Not having unique IDs will always cause trouble. Not recommended. > >> I've tried various techniques, including building a JS object structure... >> Something like $("#t

[jQuery] Re: Design question.

2008-01-19 Thread polyrhythmic
Hello Shawn, Not having unique IDs will always cause trouble. Not recommended. > I've tried various techniques, including building a JS object structure... > Something like $("#trigger")[0].extraData = { id: 4 }; ? If you need data stored relative to elements, you could store information with

[jQuery] Re: Design question.

2008-01-19 Thread Shawn
A good start, but I see a few issues here. Both from the same line of code: var id = $(this).parent().parent().attr('id).substr(1); 1) the structure has to be known for this to work. (i.e. the ancestor element two levels up contains the ID). This may be a non-fixable thing though. You're go

[jQuery] Re: Design question.

2008-01-18 Thread J Moore
A simple work around is to append a character to the id to keep them unique. But also, store the ID in the parent TR. e.g. Bob Smith link 1 Then you can get the id with $('div.1-Jan-2008').click(function() { var id = $(this).parent().parent().attr('id).substr(1); alert("do something wit