更改 JQuery Flexigrid 上的列标题文本?

发布于 2024-08-24 17:15:28 字数 457 浏览 2 评论 0原文

我有一个 jquery flexigrid,我正在动态更改它,以便它显示不同的表格数据。我想在更改数据源(通过我成功执行的“url”)的同时,更改表列标题文本,但不太清楚如何执行此操作。例如,我希望一个 Flexigrid 表显示“员工”,然后如果用户单击一个链接,则该 Flexigrid 表显示“购买”。当用户进行此更改时,列标题文本需要反映购买列标题,以匹配我通过管道传输到它的 JSON 数据。同样,除了列标题文本之外,我可以毫无问题地让所有内容正常工作。当用户选择“购买”表在 Flexigrid 上查看时,我不知道如何更改标题文本。

这篇文章说明了如何做类似的事情,我试图用它作为基础来自己解决这个问题,但很快就登上了失败的船:flexigrid 上一致的标头

I have a jquery flexigrid that I'm dynamically changing so that it displays different tabular data. I want, along with changing the data source (via the 'url' which I'm doing successfully), to change the table column header text but can't quite figure out how to do so. So, for example, I want one flexigrid table to display the 'employees' and then if the user clicks a link, for that same flexigrid to display 'purchases'. When the user makes this change, the column header text needs to reflect the purchases column headers to match the JSON data I'm piping to it. Again, I'm having no problem getting everything to work except for the column header text. I can't figure out how to change the header text when the user selects the 'purchases' table to view on the flexigrid.

this post illustrates how to do something similiar and I attempted to use it as a base to figure it out myself but quickly boarded the fail boat: consistent headers on flexigrid

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

清风不识月 2024-08-31 17:15:28

可能有更好的方法来做到这一点,但它

   $('#test').click(function() {
   var new_headers =new Array("Saab","Volvo","BMW");
    $("#flex").parent(".bDiv").siblings(".hDiv").find("table tr th div").each(function(x){
      $(this).text(new_headers[x]);
    });
  });

在这里工作是我起诉的 heml 请务必

 <div id="flexgrid">
    <table id="flex"></table>
  </div>

在加载或重新加载 Flexigrid 后执行此操作

  <input type="button" id="test" />

there may be a better way to do this but it works

   $('#test').click(function() {
   var new_headers =new Array("Saab","Volvo","BMW");
    $("#flex").parent(".bDiv").siblings(".hDiv").find("table tr th div").each(function(x){
      $(this).text(new_headers[x]);
    });
  });

here is the heml i sued

 <div id="flexgrid">
    <table id="flex"></table>
  </div>

be sure to do this after the flexigrid has ben loaded or reloaded

  <input type="button" id="test" />
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文