如何根据日期值对 html table 列值进行排序

How to sort an html table column values based on Date values

我正在使用一些存储的数据库 (EF) 值并将它们显示在 html table 中以生成报告(通过 API 请求)。 这就是我调用变量的方式

    foreach (var obj in meeting.Where(n => n.ParentID == vmContent.ParentID))
                {
                    Compliance = Compliance + obj.Compliance;
                    DirectivesList = DirectivesList + obj.MeetingTypeName + obj.MeetingDate.ToDatePickerFormat() + obj.Directives;
                }

这就是我为 HTML tables

编写代码的方式
            <td style='font-family:&quot;Bookman Old Style&quot;,serif;vertical-align: top;border-bottom:1px solid black; border-left:none; border-right:1px solid black; border-top:none; padding:5px;width:170px'>
            <p><span style='font-size:11pt'>" + DirectivesList + @"</span></p>
            </td>
            <td style='font-family:&quot;Bookman Old Style&quot;,serif;vertical-align: top;border-bottom:1px solid black; border-left:none; border-right:1px solid black; border-top:none; padding:5px;width:170px'>
            <p>" + Compliance + @"</p>
            </td>

这是我的 table 列的显示方式 Table Preview

对我来说,其他一切都很好,唯一的问题是,我想根据指令列表中包含的会议日期对这些值进行排序。任何想法如何在不使用查询的情况下做到这一点? 我可以在不使用任何按钮的情况下使用 HTML/CSS/Javascript 根据会议日期对这些值进行排序吗?

您可以在后面的代码中安排会议。

var meetings = meeting.Where(n => n.ParentID == vmContent.ParentID).OrderByDescending(x => x.MeetingDate);
foreach (var obj in meetings)
{

}