Loading editor/widgets/table/table.cpp +21 −2 Original line number Diff line number Diff line Loading @@ -823,10 +823,23 @@ extern "C" { int startRow = 0; // Combines the imported HTML-import class (if any) with the // mobile-responsive class (if any) into one class attribute // value -- see cellClassData/rowClassData's own doc comment // for why the former needs to keep reaching the rendered // element at all. auto combineClasses = [](const std::string &a, const std::string &b) { if (a.empty()) return b; if (b.empty()) return a; return a + " " + b; }; // Header row if (hasHeader && numRows > 0) { libhtmlpp::HtmlElement thead("thead"); libhtmlpp::HtmlElement tr("tr"); if (!getRowClassVal(0).empty()) tr.setAttribute("class", getRowClassVal(0).c_str()); for (int c = 0; c < numCols; ++c) { libhtmlpp::HtmlElement th("th"); std::string thStyle = "border: " + borderStyle + "; padding: " + cellPadding + "; font-weight: bold;"; Loading @@ -835,7 +848,9 @@ extern "C" { else thStyle += " vertical-align: " + verticalAlign + ";"; } th.setAttribute("style", thStyle.c_str()); if (!mobileCellCSS.empty()) th.setAttribute("class", cellResponsiveClass.c_str()); std::string thClass = combineClasses(getCellClassVal(0, c), mobileCellCSS.empty() ? std::string() : cellResponsiveClass); if (!thClass.empty()) th.setAttribute("class", thClass.c_str()); // Render child widget into header cell if available if (curChild) { curChild->Render(th); Loading @@ -854,6 +869,8 @@ extern "C" { libhtmlpp::HtmlElement tbody("tbody"); for (int r = startRow; r < numRows; ++r) { libhtmlpp::HtmlElement tr("tr"); if (!getRowClassVal(r).empty()) tr.setAttribute("class", getRowClassVal(r).c_str()); for (int c = 0; c < numCols; ++c) { libhtmlpp::HtmlElement td("td"); std::string tdStyle = "border: " + borderStyle + "; padding: " + cellPadding + ";"; Loading @@ -862,7 +879,9 @@ extern "C" { else tdStyle += " vertical-align: " + verticalAlign + ";"; } td.setAttribute("style", tdStyle.c_str()); if (!mobileCellCSS.empty()) td.setAttribute("class", cellResponsiveClass.c_str()); std::string tdClass = combineClasses(getCellClassVal(r, c), mobileCellCSS.empty() ? std::string() : cellResponsiveClass); if (!tdClass.empty()) td.setAttribute("class", tdClass.c_str()); // Render child widget into cell if available if (curChild) { curChild->Render(td); Loading Loading
editor/widgets/table/table.cpp +21 −2 Original line number Diff line number Diff line Loading @@ -823,10 +823,23 @@ extern "C" { int startRow = 0; // Combines the imported HTML-import class (if any) with the // mobile-responsive class (if any) into one class attribute // value -- see cellClassData/rowClassData's own doc comment // for why the former needs to keep reaching the rendered // element at all. auto combineClasses = [](const std::string &a, const std::string &b) { if (a.empty()) return b; if (b.empty()) return a; return a + " " + b; }; // Header row if (hasHeader && numRows > 0) { libhtmlpp::HtmlElement thead("thead"); libhtmlpp::HtmlElement tr("tr"); if (!getRowClassVal(0).empty()) tr.setAttribute("class", getRowClassVal(0).c_str()); for (int c = 0; c < numCols; ++c) { libhtmlpp::HtmlElement th("th"); std::string thStyle = "border: " + borderStyle + "; padding: " + cellPadding + "; font-weight: bold;"; Loading @@ -835,7 +848,9 @@ extern "C" { else thStyle += " vertical-align: " + verticalAlign + ";"; } th.setAttribute("style", thStyle.c_str()); if (!mobileCellCSS.empty()) th.setAttribute("class", cellResponsiveClass.c_str()); std::string thClass = combineClasses(getCellClassVal(0, c), mobileCellCSS.empty() ? std::string() : cellResponsiveClass); if (!thClass.empty()) th.setAttribute("class", thClass.c_str()); // Render child widget into header cell if available if (curChild) { curChild->Render(th); Loading @@ -854,6 +869,8 @@ extern "C" { libhtmlpp::HtmlElement tbody("tbody"); for (int r = startRow; r < numRows; ++r) { libhtmlpp::HtmlElement tr("tr"); if (!getRowClassVal(r).empty()) tr.setAttribute("class", getRowClassVal(r).c_str()); for (int c = 0; c < numCols; ++c) { libhtmlpp::HtmlElement td("td"); std::string tdStyle = "border: " + borderStyle + "; padding: " + cellPadding + ";"; Loading @@ -862,7 +879,9 @@ extern "C" { else tdStyle += " vertical-align: " + verticalAlign + ";"; } td.setAttribute("style", tdStyle.c_str()); if (!mobileCellCSS.empty()) td.setAttribute("class", cellResponsiveClass.c_str()); std::string tdClass = combineClasses(getCellClassVal(r, c), mobileCellCSS.empty() ? std::string() : cellResponsiveClass); if (!tdClass.empty()) td.setAttribute("class", tdClass.c_str()); // Render child widget into cell if available if (curChild) { curChild->Render(td); Loading