Project

General

Profile

Bug #3071

[wt-3.3.2] WTable::moveColumn alters WTableCell's column index

Added by Стойчо Стефанов Stoycho Stefanov almost 9 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
05/05/2014
Due date:
% Done:

0%

Estimated time:

Description

Hi,

I think I have a patch for this (in attractant). Could you verify whether it fixes the bug?

I could provide an test case if necessary.

Regards,

Stoycho


Files

WTable.patch (440 Bytes) WTable.patch Стойчо Стефанов Stoycho Stefanov, 05/05/2014 08:38 PM
#1

Updated by Стойчо Стефанов Stoycho Stefanov almost 9 years ago

Stoycho Stefanov wrote:

Hi,

I think I have a patch for this (in attractant). Could you verify whether it fixes the bug?

I think I have a patch for this (in ATTACHMENT). Could you verify whether it fixes the bug in general?

#2

Updated by Koen Deforche over 8 years ago

  • Status changed from New to Resolved
  • Assignee set to Koen Deforche
  • Target version set to 3.3.3

Hey,

You are right that there was something missing here. I believe the following patch is the more general solution:

diff --git a/src/Wt/WTable.C b/src/Wt/WTable.C
index fd0a72d..af44518 100644
--- a/src/Wt/WTable.C
+++ b/src/Wt/WTable.C
@@ -451,6 +451,9 @@ void WTable::moveColumn(int from, int to)
     WTableRow::TableData cell = cells[from];
     cells.erase(cells.begin() + from);
     cells.insert(cells.begin() + to, cell);
+
+    for (unsigned j = std::min(from, to); j < cells.size(); ++j)
+      cells[j].cell->column_ = j;
   }

   flags_.set(BIT_GRID_CHANGED);
#3

Updated by Koen Deforche over 8 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF