【问题标题】:Preserve tablesorter order on postback在回发时保留 tablesorter 订单
【发布时间】:2014-04-24 17:15:48
【问题描述】:

我在 ASP.NET 上使用带有 Gridview 的 Tablesorter 2.0 插件。我用这段代码修复了THEAD 问题:

if (GridView1.Rows.Count > 0)
   {
      GridView1.UseAccessibleHeader = true;
      GridView1.HeaderRow.TableSection = TableRowSection.TableHeader;
      GridView1.FooterRow.TableSection = TableRowSection.TableFooter;
   }

对行进行排序时一切正常,但是当我使用此代码在单击每一行时执行postback 时,问题就开始了

Private Sub GridView1_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GridView1.RowDataBound
        If e.Row.RowType = DataControlRowType.DataRow Then
            e.Row.Attributes("onclick") = Page.ClientScript.GetPostBackClientHyperlink(GridView1, "Select$" & e.Row.RowIndex)
        End If
End Sub

Tablesorter 一直运行良好,我可以对列进行排序,但是当我单击 gridview 上的一行以执行回发时 <tr onclick="javascript:__doPostBack('ctl00$MainContent$GridView1','Select$1')"> 我之前的排序行返回到它们的原始位置,就像第一次加载一样,并且不保留我所做的排序。以防万一,我也在使用UpdatePanel

【问题讨论】:

    标签: asp.net ajaxcontroltoolkit tablesorter rowdatabound


    【解决方案1】:

    我有一个fork of tablesorter,它有一个saveSort widget,它将当前排序保存到本地存储,并带有cookie回退。遗憾的是,该小部件不适用于原始版本的 tablesorter。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-01-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-16
      • 1970-01-01
      • 2012-05-03
      • 1970-01-01
      相关资源
      最近更新 更多