mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-17 19:25:53 +02:00
added remoteSort capability
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
#include "Poco/WebWidgets/ExtJS/TableRenderer.h"
|
||||
#include "Poco/WebWidgets/ExtJS/Utility.h"
|
||||
#include "Poco/WebWidgets/Table.h"
|
||||
#include "Poco/WebWidgets/SortedTableModel.h"
|
||||
#include "Poco/DateTime.h"
|
||||
|
||||
|
||||
@@ -46,14 +47,18 @@ namespace WebWidgets {
|
||||
namespace ExtJS {
|
||||
|
||||
|
||||
void ArrayTableSerializer::serialize(std::ostream& ostr, const Table* pTable, std::size_t rowBegin, std::size_t rowCntUser)
|
||||
void ArrayTableSerializer::serialize(std::ostream& ostr, const Table* pTable, std::size_t rowBegin, std::size_t rowCntUser, int sortCol, bool sortAscending )
|
||||
{
|
||||
//[
|
||||
// ['3m Co',71.72,0.02,0.03,'9/1 12:00am'],
|
||||
// ['Alcoa Inc',29.01,0.42,1.47,'9/1 12:00am']
|
||||
//]
|
||||
// render the row-index as last column
|
||||
const TableModel& tm = pTable->getModel();
|
||||
SortedTableModel::Ptr pSorted;
|
||||
if (sortCol >= 0)
|
||||
pSorted = pTable->getSortedModel(static_cast<std::size_t>(sortCol), sortAscending);
|
||||
|
||||
const TableModel& tm = ((sortCol >= 0)?*pSorted:pTable->getModel());
|
||||
const Table::TableColumns& tc = pTable->getColumns();
|
||||
if (rowCntUser == 0 && pTable->getPagingSize() > 0)
|
||||
rowCntUser = pTable->getPagingSize();
|
||||
|
@@ -673,7 +673,7 @@ void TableRenderer::onBeforeLoad(void* pSender, Table::LoadData& ld)
|
||||
ld.pResponse->setChunkedTransferEncoding(true);
|
||||
ld.pResponse->setContentType(ArrayTableSerializer::contentType());
|
||||
std::ostream& out = ld.pResponse->send();
|
||||
ArrayTableSerializer::serialize(out, ld.pTable, ld.firstRow, ld.rowCnt);
|
||||
ArrayTableSerializer::serialize(out, ld.pTable, ld.firstRow, ld.rowCnt, ld.sortByColumn, ld.sortAscending);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user