Skip to content

Commit

Permalink
Fix ICAT datetime in GUI. Refs #8209.
Browse files Browse the repository at this point in the history
- Sorting should happen only when data is in the table.
- Changed the format of dates to allow them to be sorted easier.
  • Loading branch information
jawrainey committed Oct 24, 2013
1 parent b70f3c2 commit 4883505
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Code/Mantid/Framework/ICat/src/ICat4/ICat4Catalog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,12 +360,12 @@ namespace Mantid
// Again, we need to check first if start and end date exist prior to insertion.
if (investigation->startDate)
{
std::string startDate = formatDateTime(*investigation->startDate, "%d-%m-%y");
std::string startDate = formatDateTime(*investigation->startDate, "%F");
savetoTableWorkspace(&startDate, table);
}
if (investigation->endDate)
{
std::string endDate = formatDateTime(*investigation->endDate, "%d-%m-%y");
std::string endDate = formatDateTime(*investigation->endDate, "%F");
savetoTableWorkspace(&endDate, table);
}
}
Expand Down
8 changes: 4 additions & 4 deletions Code/Mantid/MantidQt/MantidWidgets/src/ICatSearch2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,6 @@ namespace MantidQt
table->setSortingEnabled(false);
table->verticalHeader()->setVisible(false);

// Sort by endDate with the most recent being first.
table->sortByColumn(4,Qt::DescendingOrder);
table->setSortingEnabled(true);

// Set the height on each row to 20 for UX improvement.
for (size_t i = 0; i < numOfRows; ++i)
{
Expand Down Expand Up @@ -703,6 +699,10 @@ namespace MantidQt

// Show only a portion of the title as they can be quite long.
resultsTable->setColumnWidth(headerIndexByName(resultsTable, "Title"), 210);

// Sort by endDate with the most recent being first.
resultsTable->setSortingEnabled(true);
resultsTable->sortByColumn(4,Qt::DescendingOrder);
}

/**
Expand Down

0 comments on commit 4883505

Please sign in to comment.