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 pretty straight forward using jquery i guess. On Nov 24, 5:40 pm, daveyoi <[EMAIL PROTECTED]> wrote: > Hello Everyone, > > I am new to jquery and am using it in a project to develop a PHP based > Mysql report generator. My question is not 100% jquery but more on > application design? > > I have a bunch of list items that I can drag and drop (thanks to > jquery) on to a workspace - on dropping I create a <TH></TH> elelment > with the value of the list item and an image which has a .click() > attached with a call back to a remove(). - This all works as expected > and really demonstrates how after just a couple of hours how powerfull > jquery is. > > The hard part that I just cant get my head round is I need the value > and position of each item dropped onto the page stored somehow. I have > been using a bog standard js array and just pushing the new value into > the array on the drop callback but if I remove one of the <TH></TH> > then my array keys become out of sync. > > Any suggestions on how best to approach this - I am primarily a PHP > developer and have been thinking of using Ajax to store the data in a > temp table but this seems a little longwinded.. js gurus your ideas? > > Thanks - and hope I can repay the favour some time. > > Dave