Loading ...
Sorry, an error occurred while loading the content.

Re: Move rows from one datatable to another and KeyListener problemer

Expand Messages
  • jennykhan
    Hi casperskovgaard, In line 144, just change availableDT.selectRow(availableDT.getTrEl(selectedIndex)); to availableDT.unselectAllRows();
    Message 1 of 2 , Dec 1, 2008
    • 0 Attachment
      Hi casperskovgaard,

      In line 144, just change

      availableDT.selectRow(availableDT.getTrEl(selectedIndex));

      to

      availableDT.unselectAllRows();
      availableDT.selectRow(availableDT.getTrEl(selectedIndex));

      Regards,
      Jenny



      --- In ydn-javascript@yahoogroups.com, "casperskovgaard"
      <casperskovgaard@...> wrote:
      >
      > I have two datatables, in dt1 you can select a row and press
      [space],
      > and the row is move to dt2. This is done by first dt2.addRow and
      then
      > dt1.deleteRow. Since the selected row is deleted I select the next
      row
      > in dt1. This works, the problem is that nothing happens if I press
      > [space] again. To move the next row I first have to select another
      and
      > then select it again.
      >
      > here is the move code:
      >
      > var selectedRows = availableDT.getSelectedRows();
      > var selectedIndex = 0;
      >
      > for (var i=0; i<selectedRows.length; i++) {
      > selectedIndex = availableDT.getRecordIndex
      (selectedRows[i]);
      > selectedDT.addRow(availableDT.getRecord
      (selectedIndex).getData());
      >
      > availableDT.deleteRow(selectedRows[i]);
      > }
      >
      > if (availableDT.getRecordSet().getLength() <= selectedIndex)
      {
      > selectedIndex = availableDT.getRecordSet().getLength
      () - 1;
      > }
      >
      > availableDT.selectRow(availableDT.getTrEl(selectedIndex));
      > availableDT.focus();
      >
      >
      > full code example can be downloaded here:
      > http://www.box.net/shared/km0qq3q1vv
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.