mirror of
https://github.com/pocoproject/poco.git
synced 2025-11-25 15:19:21 +01:00
updated MultiSelect
This commit is contained in:
@@ -97,6 +97,7 @@ void ListBox::init()
|
||||
_pLBCell->beforeLoad += Poco::delegate(this, &ListBox::fireBeforeLoad);
|
||||
_pLBCell->rowDeselected += Poco::delegate(this, &ListBox::fireRowDeselected);
|
||||
_pLBCell->rowSelected += Poco::delegate(this, &ListBox::fireRowSelected);
|
||||
_pLBCell->selectionChanged += Poco::delegate(this, &ListBox::fireSelectionChange);
|
||||
setCell(_pLBCell);
|
||||
}
|
||||
|
||||
@@ -110,6 +111,7 @@ void ListBox::init(Cell::Ptr ptrCell)
|
||||
_pLBCell->beforeLoad += Poco::delegate(this, &ListBox::fireBeforeLoad);
|
||||
_pLBCell->rowDeselected += Poco::delegate(this, &ListBox::fireRowDeselected);
|
||||
_pLBCell->rowSelected += Poco::delegate(this, &ListBox::fireRowSelected);
|
||||
_pLBCell->selectionChanged += Poco::delegate(this, &ListBox::fireSelectionChange);
|
||||
setCell(ptrCell);
|
||||
}
|
||||
|
||||
@@ -139,4 +141,10 @@ void ListBox::fireRowDeselected(int& pos)
|
||||
}
|
||||
|
||||
|
||||
void ListBox::fireSelectionChange(const std::set<int>& sel)
|
||||
{
|
||||
selectionChanged(this, sel);
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::WebWidgets
|
||||
|
||||
@@ -47,11 +47,8 @@ namespace WebWidgets {
|
||||
|
||||
const std::string ListBoxCell::EV_LOADDATA("load");
|
||||
const std::string ListBoxCell::EV_AFTERLOAD("afterLoad");
|
||||
const std::string ListBoxCell::EV_ROWSELECTED("rowSel");
|
||||
const std::string ListBoxCell::ARG_SELECTED("sel");
|
||||
const std::string ListBoxCell::EV_SELECTIONCHANGED("selChange");
|
||||
const std::string ListBoxCell::ARG_ROW("row");
|
||||
const std::string ListBoxCell::VAL_SELECTED("1");
|
||||
const std::string ListBoxCell::VAL_DESELECTED("0");
|
||||
|
||||
|
||||
ListBoxCell::ListBoxCell(View* pOwner):
|
||||
@@ -96,6 +93,8 @@ void ListBoxCell::handleForm(const std::string& field, const std::string& value)
|
||||
else
|
||||
deselectByIndex(i);
|
||||
}
|
||||
|
||||
selectionChanged(this, selected);
|
||||
}
|
||||
|
||||
|
||||
@@ -269,11 +268,9 @@ void ListBoxCell::handleAjaxRequest(const Poco::Net::NameValueCollection& args,
|
||||
afterLoad(this);
|
||||
response.send();
|
||||
}
|
||||
else if (ev == EV_ROWSELECTED)
|
||||
else if (ev == EV_SELECTIONCHANGED)
|
||||
{
|
||||
int row = Poco::NumberParser::parse(args[ARG_ROW]);
|
||||
bool sel = (args.get(ARG_SELECTED) == VAL_SELECTED);
|
||||
selectByIndex(row, sel);
|
||||
handleForm("", args[ARG_ROW]);
|
||||
response.send();
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user