mirror of
https://github.com/pocoproject/poco.git
synced 2025-11-24 22:29:47 +01:00
fixed events
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
|
||||
#include "Poco/WebWidgets/TextFieldCell.h"
|
||||
#include "Poco/WebWidgets/TextField.h"
|
||||
#include "Poco/WebWidgets/RequestHandler.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
@@ -86,12 +87,26 @@ void TextFieldCell::handleForm(const std::string& field, const std::string& valu
|
||||
{
|
||||
Poco::Any newValue = getFormatter()->parse(value);
|
||||
ValueChange vc(getFormatter(), getValue(), newValue);
|
||||
setValue(value);
|
||||
setValue(newValue);
|
||||
textChanged.notify(this, vc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TextFieldCell::handleAjaxRequest(const Poco::Net::NameValueCollection& args, Poco::Net::HTTPServerResponse& response)
|
||||
{
|
||||
const std::string& ev = args[RequestHandler::KEY_EVID];
|
||||
if (ev == EV_TEXTCHANGED)
|
||||
{
|
||||
Formatter::Ptr pForm = getFormatter();
|
||||
handleForm("", args[FIELD_NEWVAL]);
|
||||
response.send();
|
||||
}
|
||||
else
|
||||
response.send();
|
||||
}
|
||||
|
||||
|
||||
bool TextFieldCell::serializeJSON(std::ostream& out, const std::string& name)
|
||||
{
|
||||
out << name << ":";
|
||||
|
||||
@@ -77,7 +77,6 @@ void TimeFieldCell::setFormat(TimeField::Format fmt)
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool TimeFieldCell::serializeJSON(std::ostream& out, const std::string& name)
|
||||
{
|
||||
out << name << ":";
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
|
||||
#include "Poco/WebWidgets/ToggleButtonCell.h"
|
||||
#include "Poco/WebWidgets/BoolFormatter.h"
|
||||
#include "Poco/WebWidgets/RequestHandler.h"
|
||||
#include "Poco/String.h"
|
||||
|
||||
|
||||
@@ -101,4 +102,21 @@ bool ToggleButtonCell::serializeJSON(std::ostream& out, const std::string& name)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void ToggleButtonCell::handleAjaxRequest(const Poco::Net::NameValueCollection& args, Poco::Net::HTTPServerResponse& response)
|
||||
{
|
||||
const std::string& ev = args[RequestHandler::KEY_EVID];
|
||||
if (ev == EV_CHECKED)
|
||||
{
|
||||
bool check = false;
|
||||
if (args[FIELD_VAL] == "true")
|
||||
check = true;
|
||||
setChecked(check);
|
||||
|
||||
response.send();
|
||||
}
|
||||
else
|
||||
response.send();
|
||||
}
|
||||
|
||||
} } // namespace Poco::WebWidgets
|
||||
|
||||
Reference in New Issue
Block a user