WIP: feat(sorting): proposta di modifica per il sorting dei soci nella tab Rinnovi secondo i campi id, nome o cognome. #8
|
@ -28,13 +28,18 @@ RenewalTab::RenewalTab(QWidget *parent) :
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ui->orderBy->addItem("id");
|
||||||
|
ui->orderBy->addItem("nome");
|
||||||
|
ui->orderBy->addItem("cognome");
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenewalTab::refresh() {
|
void RenewalTab::refresh() {
|
||||||
const int anno = ui->renewalYear->currentData().toInt();
|
const int anno = ui->renewalYear->currentData().toInt();
|
||||||
|
const QString order_by = ui->orderBy->currentText();
|
||||||
|
QString query_str = "SELECT YEAR(i.anno) AS anno, s.id, s.cognome, s.nome FROM iscrizione AS i INNER JOIN socio AS s ON s.id = i.socio WHERE YEAR(i.anno) = :anno";
|
||||||
|
query_str += " ORDER BY s." + order_by;
|
||||||
|
|
||||||
query.prepare("SELECT YEAR(i.anno) AS anno, s.cognome, s.nome FROM iscrizione AS i INNER JOIN socio AS s ON s.id = i.socio WHERE YEAR(i.anno) = :anno ORDER BY s.cognome");
|
query.prepare(query_str);
|
||||||
query.bindValue(":anno", anno);
|
query.bindValue(":anno", anno);
|
||||||
|
|
||||||
if (! query.exec()) {
|
if (! query.exec()) {
|
||||||
|
@ -49,4 +54,4 @@ void RenewalTab::refresh() {
|
||||||
|
|
||||||
void RenewalTab::on_buttonRefresh_clicked() {
|
void RenewalTab::on_buttonRefresh_clicked() {
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,14 +10,7 @@
|
||||||
<height>421</height>
|
<height>421</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QTableView" name="table">
|
|
||||||
<attribute name="verticalHeaderVisible">
|
|
||||||
<bool>false</bool>
|
|
||||||
</attribute>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
|
@ -40,6 +33,9 @@
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="orderBy"/>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="renewalYear"/>
|
<widget class="QComboBox" name="renewalYear"/>
|
||||||
</item>
|
</item>
|
||||||
|
@ -52,6 +48,13 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QTableView" name="table">
|
||||||
|
<attribute name="verticalHeaderVisible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
|
Loading…
Reference in New Issue