mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-14 15:05:35 +02:00
afterload event added
This commit is contained in:
@@ -48,7 +48,7 @@ namespace ExtJS {
|
||||
|
||||
|
||||
const std::string PageRenderer::EV_BEFORERENDER("beforerender");
|
||||
const std::string PageRenderer::EV_AFTERRENDER("afterrender");
|
||||
const std::string PageRenderer::EV_AFTERRENDER("show"); //don't use afterrender which fires before all the children are rendered!
|
||||
|
||||
|
||||
PageRenderer::PageRenderer()
|
||||
@@ -97,6 +97,7 @@ void PageRenderer::renderHead(const Renderable* pRenderable, const RenderContext
|
||||
{
|
||||
ostr << ",listeners:{";
|
||||
bool written = Utility::writeJSEvent(ostr, EV_BEFORERENDER, pPage->beforeRender.jsDelegates());
|
||||
//auto-show all windows
|
||||
JavaScriptEvent<Page*>::JSDelegates js = pPage->afterRender.jsDelegates();
|
||||
js.push_front(jsDelegate("function(){Ext.WindowMgr.each( function(w) {w.show(this);});}"));
|
||||
if (written && !js.empty())
|
||||
@@ -129,8 +130,7 @@ void PageRenderer::renderHead(const Renderable* pRenderable, const RenderContext
|
||||
}
|
||||
//close the panel
|
||||
ostr << "]});";
|
||||
//auto-show all windows
|
||||
//ostr << "Ext.WindowMgr.each( function(w) {w.show(this);});";
|
||||
|
||||
//close onReady
|
||||
ostr << "});";
|
||||
//close inline JS block
|
||||
|
@@ -43,8 +43,10 @@
|
||||
#include "Poco/WebWidgets/WebApplication.h"
|
||||
#include "Poco/WebWidgets/RequestHandler.h"
|
||||
#include "Poco/WebWidgets/DateFormatter.h"
|
||||
#include "Poco/WebWidgets/JSDelegate.h"
|
||||
#include "Poco/Delegate.h"
|
||||
#include <sstream>
|
||||
#include <list>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
@@ -54,6 +56,7 @@ namespace ExtJS {
|
||||
|
||||
const std::string TableRenderer::EV_CELLCLICKED("cellclick");
|
||||
const std::string TableRenderer::EV_AFTEREDIT("afteredit");
|
||||
const std::string TableRenderer::EV_AFTERLOAD("load");
|
||||
const std::string TableRenderer::HIDDEN_INDEX_ROW("hidIdx");
|
||||
|
||||
|
||||
@@ -117,6 +120,16 @@ void TableRenderer::addCellValueChangedServerCallback(Table* pTable, const std::
|
||||
|
||||
|
||||
|
||||
void TableRenderer::addAfterLoadServerCallback(Table* pTable, const std::string& onSuccess, const std::string& onFailure)
|
||||
{
|
||||
poco_check_ptr (pTable);
|
||||
static const std::string signature("function(aStore, recs, op)");
|
||||
std::map<std::string, std::string> addParams;
|
||||
addParams.insert(std::make_pair(RequestHandler::KEY_EVID, Table::EV_AFTERLOAD));
|
||||
Utility::addServerCallback(pTable->afterLoad, signature, addParams, pTable->id(), onSuccess, onFailure);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void TableRenderer::addCellClickedServerCallback(Table* pTable, const std::string& onSuccess, const std::string& onFailure)
|
||||
{
|
||||
@@ -152,7 +165,6 @@ void TableRenderer::renderProperties(const Table* pTable, const RenderContext& c
|
||||
if (written)
|
||||
ostr << ",";
|
||||
|
||||
|
||||
Utility::writeJSEvent(ostr, EV_CELLCLICKED, pTable->cellClicked.jsDelegates());
|
||||
|
||||
ostr << "},"; //close listeners
|
||||
@@ -282,12 +294,13 @@ void TableRenderer::renderStore(const Table* pTable, std::ostream& ostr)
|
||||
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()";
|
||||
//Write data
|
||||
/*ostr << "data:";
|
||||
renderDataModel(pTable, ostr);*/
|
||||
ostr << ",listeners:{";
|
||||
Utility::writeJSEvent(ostr, EV_AFTERLOAD, pTable->afterLoad.jsDelegates());
|
||||
ostr << "}";
|
||||
ostr << "})";
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user