mirror of
https://github.com/pocoproject/poco.git
synced 2025-02-21 14:42:51 +01:00
paging for tables
This commit is contained in:
parent
2045597f3f
commit
00b1f3cde5
@ -78,6 +78,8 @@ public:
|
||||
static const std::string EV_CELLSELECTED;
|
||||
static const std::string EV_STARTCELLVALUECHANGE;
|
||||
static const std::string HIDDEN_INDEX_ROW;
|
||||
static const std::string FIELD_TOTALPROPERTY;
|
||||
static const std::string FIELD_ROOT;
|
||||
|
||||
TableRenderer();
|
||||
/// Creates the TableRenderer.
|
||||
|
@ -177,18 +177,24 @@ protected:
|
||||
Form::Ptr pForm = new Form("form1", Poco::URI("/"));
|
||||
//pForm->setURL(...);
|
||||
Table::TableColumns tc;
|
||||
tc.push_back(new TableColumn(new TextFieldCell(0), "StaticText", 200 ));
|
||||
tc.push_back(new TableColumn(new CheckButtonCell(0, "lbl", true), "CheckButton", 100));
|
||||
tc.push_back(new TableColumn(new TextFieldCell(0), "StaticText", 200,true ));
|
||||
tc.push_back(new TableColumn(new CheckButtonCell(0, "lbl", true), "CheckButton", 100, true));
|
||||
Table::Ptr pTable = new Table(tc, new SimpleTableModel(2));
|
||||
///init simpletablemodel
|
||||
pTable->setValue(std::string("one"), 0,0);
|
||||
pTable->setValue(std::string("two"), 1,0);
|
||||
pTable->setValue(std::string("three"), 2,0);
|
||||
pTable->setValue(std::string("four"), 3,0);
|
||||
pTable->setValue(std::string("five"), 4,0);
|
||||
|
||||
pTable->setValue(true, 0,1);
|
||||
pTable->setValue(false, 1,1);
|
||||
pTable->setValue(true, 2,1);
|
||||
pTable->setValue(false, 3,1);
|
||||
pTable->setValue(true, 4,1);
|
||||
pTable->setWidth(310);
|
||||
pTable->setHeight(200);
|
||||
pTable->setPaging(2);
|
||||
|
||||
pForm->add(new TextField("txtfield"));
|
||||
CheckButton::Ptr ptrCheck2(new CheckButton("checkbutton", "CheckButton", false));
|
||||
|
@ -35,6 +35,8 @@
|
||||
|
||||
|
||||
#include "Poco/WebWidgets/ExtJS/ArrayTableSerializer.h"
|
||||
#include "Poco/WebWidgets/ExtJS/TableRenderer.h"
|
||||
#include "Poco/WebWidgets/ExtJS/Utility.h"
|
||||
#include "Poco/WebWidgets/Table.h"
|
||||
#include "Poco/DateTime.h"
|
||||
|
||||
@ -53,7 +55,8 @@ void ArrayTableSerializer::serialize(std::ostream& ostr, const Table* pTable, st
|
||||
// render the row-index as last column
|
||||
const TableModel& tm = pTable->getModel();
|
||||
const Table::TableColumns& tc = pTable->getColumns();
|
||||
|
||||
if (rowCntUser == 0 && pTable->getPagingSize() > 0)
|
||||
rowCntUser = pTable->getPagingSize();
|
||||
poco_assert_dbg (tc.size() == tm.getColumnCount());
|
||||
|
||||
std::size_t colCnt = tm.getColumnCount();
|
||||
@ -62,10 +65,11 @@ void ArrayTableSerializer::serialize(std::ostream& ostr, const Table* pTable, st
|
||||
rowBegin = 0;
|
||||
if ((rowCntUser > 0) && (rowBegin + rowCntUser < rowCnt))
|
||||
rowCnt = rowBegin + rowCntUser;
|
||||
ostr << "[";
|
||||
ostr << "{\"" << TableRenderer::FIELD_TOTALPROPERTY << "\":\"" << tm.getRowCount() << "\",";
|
||||
ostr << "\"" << TableRenderer::FIELD_ROOT << "\":[";
|
||||
for (std::size_t row = rowBegin; row < rowCnt; ++row)
|
||||
{
|
||||
if (row != 0)
|
||||
if (row != rowBegin)
|
||||
ostr << ",[";
|
||||
else
|
||||
ostr << "[";
|
||||
@ -88,7 +92,7 @@ void ArrayTableSerializer::serialize(std::ostream& ostr, const Table* pTable, st
|
||||
bool isString = (typeid(std::string) == aVal.type());
|
||||
Cell::Ptr ptrCell = tc[col]->getCell();
|
||||
if (isString)
|
||||
ostr << "'" << RefAnyCast<std::string>(aVal) << "'";
|
||||
ostr << "'" << Utility::safe(RefAnyCast<std::string>(aVal)) << "'";
|
||||
else if (ptrCell)
|
||||
{
|
||||
//date must be written as string
|
||||
@ -105,7 +109,7 @@ void ArrayTableSerializer::serialize(std::ostream& ostr, const Table* pTable, st
|
||||
ostr << "," << row;
|
||||
ostr << "]";
|
||||
}
|
||||
ostr << "]";
|
||||
ostr << "]}";
|
||||
}
|
||||
|
||||
|
||||
|
@ -70,6 +70,8 @@ const std::string TableRenderer::EV_KEYPRESSED("keypress");
|
||||
const std::string TableRenderer::EV_ROWSELECTED("rowselect");
|
||||
const std::string TableRenderer::EV_CELLSELECTED("cellselect");
|
||||
const std::string TableRenderer::HIDDEN_INDEX_ROW("hidIdx");
|
||||
const std::string TableRenderer::FIELD_TOTALPROPERTY("tp");
|
||||
const std::string TableRenderer::FIELD_ROOT("data");
|
||||
|
||||
|
||||
TableRenderer::TableRenderer()
|
||||
@ -516,7 +518,6 @@ void TableRenderer::renderProperties(const Table* pTable, const RenderContext& c
|
||||
// })
|
||||
if (pTable->getPagingSize() > 0)
|
||||
{
|
||||
ostr << ",remoteSort:true";
|
||||
ostr << ",bbar:new Ext.PagingToolbar({";
|
||||
ostr << "pageSize:" << pTable->getPagingSize() << ",";
|
||||
ostr << "displayInfo:true,";
|
||||
@ -649,17 +650,19 @@ void TableRenderer::renderStore(const Table* pTable, std::ostream& ostr)
|
||||
ostr << "proxy:new Ext.data.HttpProxy({url:";
|
||||
std::map<std::string, std::string> addParams;
|
||||
addParams.insert(std::make_pair(RequestHandler::KEY_EVID,Table::EV_LOADDATA));
|
||||
|
||||
|
||||
|
||||
std::string url(Utility::createURI(addParams, pTable->id()));
|
||||
ostr << url << "}),";
|
||||
ostr << "reader:new Ext.data.ArrayReader()";
|
||||
ostr << "reader:new Ext.data.ArrayReader({totalCnt:'";
|
||||
ostr << FIELD_TOTALPROPERTY << "',data:'" << FIELD_ROOT << "'})";
|
||||
if (pTable->afterLoad.hasJavaScriptCode())
|
||||
{
|
||||
ostr << ",listeners:{";
|
||||
Utility::writeJSEvent(ostr, EV_AFTERLOAD, pTable->afterLoad, &TableRenderer::createAfterLoadServerCallback, pTable);
|
||||
ostr << "}";
|
||||
}
|
||||
if (pTable->getPagingSize() > 0)
|
||||
ostr << ",remoteSort:true";
|
||||
|
||||
ostr << "})";
|
||||
}
|
||||
|
@ -1,4 +1,41 @@
|
||||
Ext.override(Ext.data.ArrayReader, {
|
||||
read : function(response){
|
||||
var data = response.responseText;
|
||||
var o = eval("("+data+")");
|
||||
return this.readRecords(o);
|
||||
},
|
||||
|
||||
readRecords : function(o){
|
||||
var sid = this.meta ? this.meta.id : null;
|
||||
var s = this.meta;
|
||||
var recordType = this.recordType, fields = recordType.prototype.fields;
|
||||
var records = [];
|
||||
var root = o["data"];
|
||||
var totalRecords = o["tp"];
|
||||
for(var i = 0; i < root.length; i++){
|
||||
var n = root[i];
|
||||
var values = {};
|
||||
var id = ((sid || sid === 0) && n[sid] !== undefined && n[sid] !== "" ? n[sid] : null);
|
||||
for(var j = 0, jlen = fields.length; j < jlen; j++){
|
||||
var f = fields.items[j];
|
||||
var k = f.mapping !== undefined && f.mapping !== null ? f.mapping : j;
|
||||
var v = n[k] !== undefined ? n[k] : f.defaultValue;
|
||||
v = f.convert(v, n);
|
||||
values[f.name] = v;
|
||||
}
|
||||
var record = new recordType(values, id);
|
||||
record.json = n;
|
||||
records[records.length] = record;
|
||||
}
|
||||
return {
|
||||
success : true,
|
||||
records : records,
|
||||
totalRecords : totalRecords
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Ext.grid.AppinfTable = Ext.extend(Ext.grid.EditorGridPanel, {
|
||||
/**
|
||||
* @cfg {Boolean} autoEdit
|
||||
|
@ -681,6 +681,10 @@
|
||||
RelativePath=".\include\Poco\WebWidgets\SimpleTableModel.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\WebWidgets\SortedTableModel.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\WebWidgets\Table.h"
|
||||
>
|
||||
@ -745,6 +749,10 @@
|
||||
RelativePath=".\src\SimpleTableModel.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\SortedTableModel.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Table.cpp"
|
||||
>
|
||||
|
@ -678,6 +678,10 @@
|
||||
RelativePath=".\include\Poco\WebWidgets\SimpleTableModel.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\WebWidgets\SortedTableModel.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\WebWidgets\Table.h"
|
||||
>
|
||||
@ -742,6 +746,10 @@
|
||||
RelativePath=".\src\SimpleTableModel.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\SortedTableModel.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Table.cpp"
|
||||
>
|
||||
|
@ -60,6 +60,8 @@ public:
|
||||
|
||||
Poco::Any parse(const std::string& value) const;
|
||||
|
||||
bool lowerThan(const Poco::Any& first, const Poco::Any& second) const;
|
||||
|
||||
protected:
|
||||
~BoolFormatter();
|
||||
/// Destroys the BoolFormatter.
|
||||
|
@ -48,7 +48,7 @@ namespace WebWidgets {
|
||||
|
||||
|
||||
class WebWidgets_API DateFormatter: public Formatter
|
||||
/// DateFormatter is sued to convert Poco::DateTime to/from string
|
||||
/// DateFormatter is used to convert Poco::DateTime to/from string
|
||||
{
|
||||
public:
|
||||
typedef Poco::AutoPtr<DateFormatter> Ptr;
|
||||
@ -60,6 +60,8 @@ public:
|
||||
|
||||
Poco::Any parse(const std::string& value) const;
|
||||
|
||||
bool lowerThan(const Poco::Any& first, const Poco::Any& second) const;
|
||||
|
||||
protected:
|
||||
~DateFormatter();
|
||||
/// Destroys the DateFormatter.
|
||||
|
@ -59,6 +59,8 @@ public:
|
||||
|
||||
int precision() const;
|
||||
/// Returns the precision
|
||||
|
||||
bool lowerThan(const Poco::Any& first, const Poco::Any& second) const;
|
||||
|
||||
protected:
|
||||
~DoubleFormatter();
|
||||
|
@ -58,6 +58,16 @@ class WebWidgets_API Formatter: public Poco::RefCountedObject
|
||||
public:
|
||||
typedef Poco::AutoPtr<Formatter> Ptr;
|
||||
|
||||
struct WebWidgets_API less
|
||||
{
|
||||
Formatter& fmt;
|
||||
less (Formatter& f): fmt(f){}
|
||||
bool operator () (const Poco::Any& first, const Poco::Any& second) const
|
||||
{
|
||||
return fmt.lowerThan(first, second);
|
||||
}
|
||||
};
|
||||
|
||||
virtual std::string format(const Poco::Any& value) const = 0;
|
||||
/// Returns a string representation of the given value, suitable
|
||||
/// for displaying in a Cell.
|
||||
@ -68,6 +78,9 @@ public:
|
||||
///
|
||||
/// Throws a Poco::SyntaxException if the value cannot be parsed.
|
||||
|
||||
virtual bool lowerThan(const Poco::Any& first, const Poco::Any& second) const = 0;
|
||||
/// Lower than comparison for any's of the same type
|
||||
|
||||
protected:
|
||||
Formatter();
|
||||
virtual ~Formatter();
|
||||
|
@ -56,6 +56,8 @@ public:
|
||||
IntFormatter();
|
||||
std::string format(const Poco::Any& value) const;
|
||||
Poco::Any parse(const std::string& value) const;
|
||||
|
||||
bool lowerThan(const Poco::Any& first, const Poco::Any& second) const;
|
||||
|
||||
protected:
|
||||
~IntFormatter();
|
||||
|
94
WebWidgets/include/Poco/WebWidgets/SortedTableModel.h
Normal file
94
WebWidgets/include/Poco/WebWidgets/SortedTableModel.h
Normal file
@ -0,0 +1,94 @@
|
||||
//
|
||||
// SortedTableModel.h
|
||||
//
|
||||
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/SortedTableModel.h#4 $
|
||||
//
|
||||
// Library: WebWidgets
|
||||
// Package: Views
|
||||
// Module: SortedTableModel
|
||||
//
|
||||
// Definition of the SortedTableModel class.
|
||||
//
|
||||
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef WebWidgets_SortedTableModel_INCLUDED
|
||||
#define WebWidgets_SortedTableModel_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/WebWidgets/WebWidgets.h"
|
||||
#include "Poco/WebWidgets/TableModel.h"
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include "Poco/Any.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace WebWidgets {
|
||||
|
||||
|
||||
class WebWidgets_API SortedTableModel: public TableModel
|
||||
/// SortedTableModel defines the interface for data retrieval for a Table
|
||||
{
|
||||
public:
|
||||
typedef Poco::AutoPtr<SortedTableModel> Ptr;
|
||||
|
||||
SortedTableModel(TableModel::Ptr pModel, std::size_t col, bool sortAscending);
|
||||
/// Creates the SortedTableModel.Sorts pModel via col and if sortWithLess is
|
||||
/// true by less otherwise by more
|
||||
|
||||
const Poco::Any& getValue(std::size_t row, std::size_t col) const;
|
||||
///Returns the value at pos(row, col) or an empty Any if no data is stored there
|
||||
|
||||
std::size_t getRowCount() const;
|
||||
/// Returns the total number of rows
|
||||
|
||||
void setValue(const Poco::Any& val, std::size_t row, std::size_t col);
|
||||
/// Sets the value at pos(row, col)
|
||||
|
||||
void deleteRow(std::size_t row);
|
||||
/// Removes the row from the SortedTableModel
|
||||
|
||||
void clear();
|
||||
/// Deletes all rows from the SortedTableModel
|
||||
|
||||
void sort(std::size_t col, bool sortAscending);
|
||||
|
||||
protected:
|
||||
virtual ~SortedTableModel();
|
||||
/// Destroys the SortedTableModel.
|
||||
|
||||
private:
|
||||
TableModel::Ptr _pUnsorted;
|
||||
std::size_t _sortCol;
|
||||
bool _sortAscending;
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::WebWidgets
|
||||
|
||||
|
||||
#endif // WebWidgets_SortedTableModel_INCLUDED
|
@ -57,6 +57,8 @@ public:
|
||||
std::string format(const Poco::Any& value) const;
|
||||
Poco::Any parse(const std::string& value) const;
|
||||
|
||||
bool lowerThan(const Poco::Any& first, const Poco::Any& second) const;
|
||||
|
||||
protected:
|
||||
~StringFormatter();
|
||||
|
||||
|
@ -78,4 +78,14 @@ Poco::Any BoolFormatter::parse(const std::string& value) const
|
||||
}
|
||||
|
||||
|
||||
bool BoolFormatter::lowerThan(const Poco::Any& first, const Poco::Any& second) const
|
||||
{
|
||||
if (first.empty())
|
||||
return true;
|
||||
if (second.empty())
|
||||
return false;
|
||||
|
||||
return Poco::AnyCast<bool>(first) < Poco::AnyCast<bool>(second);
|
||||
}
|
||||
|
||||
} } // namespace Poco::WebWidgets
|
||||
|
@ -71,4 +71,15 @@ Poco::Any DateFormatter::parse(const std::string& value) const
|
||||
}
|
||||
|
||||
|
||||
bool DateFormatter::lowerThan(const Poco::Any& first, const Poco::Any& second) const
|
||||
{
|
||||
if (first.empty())
|
||||
return true;
|
||||
if (second.empty())
|
||||
return false;
|
||||
|
||||
return Poco::RefAnyCast<DateTime>(first) < Poco::RefAnyCast<DateTime>(second);
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::WebWidgets
|
||||
|
@ -70,4 +70,15 @@ Poco::Any DoubleFormatter::parse(const std::string& value) const
|
||||
}
|
||||
|
||||
|
||||
bool DoubleFormatter::lowerThan(const Poco::Any& first, const Poco::Any& second) const
|
||||
{
|
||||
if (first.empty())
|
||||
return true;
|
||||
if (second.empty())
|
||||
return false;
|
||||
|
||||
return Poco::AnyCast<double>(first) < Poco::AnyCast<double>(second);
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::WebWidgets
|
||||
|
@ -69,4 +69,15 @@ Poco::Any IntFormatter::parse(const std::string& value) const
|
||||
}
|
||||
|
||||
|
||||
bool IntFormatter::lowerThan(const Poco::Any& first, const Poco::Any& second) const
|
||||
{
|
||||
if (first.empty())
|
||||
return true;
|
||||
if (second.empty())
|
||||
return false;
|
||||
|
||||
return Poco::AnyCast<int>(first) < Poco::AnyCast<int>(second);
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::WebWidgets
|
||||
|
94
WebWidgets/src/SortedTableModel.cpp
Normal file
94
WebWidgets/src/SortedTableModel.cpp
Normal file
@ -0,0 +1,94 @@
|
||||
//
|
||||
// SortedTableModel.cpp
|
||||
//
|
||||
// $Id: //poco/Main/WebWidgets/src/SortedTableModel.cpp#3 $
|
||||
//
|
||||
// Library: WebWidgets
|
||||
// Package: Views
|
||||
// Module: SortedTableModel
|
||||
//
|
||||
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/WebWidgets/SortedTableModel.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace WebWidgets {
|
||||
|
||||
|
||||
SortedTableModel::SortedTableModel(TableModel::Ptr pModel, std::size_t col, bool sortAscending):
|
||||
TableModel(pModel->getColumnCount()),
|
||||
_pUnsorted(pModel),
|
||||
_sortCol(col),
|
||||
_sortAscending(sortAscending)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
SortedTableModel::~SortedTableModel()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
const Poco::Any& SortedTableModel::getValue(std::size_t row, std::size_t col) const
|
||||
{
|
||||
throw Poco::NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
std::size_t SortedTableModel::getRowCount() const
|
||||
{
|
||||
throw Poco::NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
void SortedTableModel::setValue(const Poco::Any& val, std::size_t row, std::size_t col)
|
||||
{
|
||||
throw Poco::NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
void SortedTableModel::deleteRow(std::size_t row)
|
||||
{
|
||||
throw Poco::NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
void SortedTableModel::clear()
|
||||
{
|
||||
throw Poco::NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
void SortedTableModel::sort(std::size_t col, bool sortAscending)
|
||||
{
|
||||
throw Poco::NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::WebWidgets
|
@ -63,4 +63,15 @@ Poco::Any StringFormatter::parse(const std::string& value) const
|
||||
}
|
||||
|
||||
|
||||
bool StringFormatter::lowerThan(const Poco::Any& first, const Poco::Any& second) const
|
||||
{
|
||||
if (first.empty())
|
||||
return true;
|
||||
if (second.empty())
|
||||
return false;
|
||||
|
||||
return Poco::RefAnyCast<std::string>(first) < Poco::RefAnyCast<std::string>(second);
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::WebWidgets
|
||||
|
@ -160,6 +160,10 @@ void Table::handleAjaxRequest(const Poco::Net::NameValueCollection& args, Poco::
|
||||
Poco::NumberParser::tryParse(strCnt, cnt);
|
||||
if (ev == EV_LOADDATA)
|
||||
{
|
||||
const std::string& strLimit = args.get("limit", strCnt); //Extjs hack
|
||||
const std::string& strStart = args.get("start", strRow);
|
||||
Poco::NumberParser::tryParse(strStart, row);
|
||||
Poco::NumberParser::tryParse(strLimit, cnt);
|
||||
/// serialize the Table back
|
||||
/// check for cnt and start if only a segment was requested
|
||||
if (row < 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user