【问题标题】:How to navigate to another page with id param on Ag-grid?如何在 Ag-grid 上使用 id 参数导航到另一个页面?
【发布时间】:2020-08-20 10:22:16
【问题描述】:

我正在尝试编辑显示在 Ag-Grid 表中的记录。我想在单击 Ag-grid 的特定单元格时导航到编辑页面,并且必须推送该记录的 ID 参数以填充编辑页面。 我的应用程序是用 Vue.Js 构建的。任何人都可以帮助解决这个问题吗?请。!

【问题讨论】:

    标签: vue.js ag-grid


    【解决方案1】:

    这对我有用。我希望它也对你有用。

    {
              headerName: "ID",
              field: "idvalue",
              cellRenderer: params => {
                const route = {
                  name: "editpage",  // name will be same as stated in the route by you
                  params: { id: params.value } 
                };
    
                const link = document.createElement("a");
                link.href = this.$router.resolve(route).href;
                link.innerText = params.value;
                link.addEventListener("click", e => {
                  e.preventDefault();
                  this.$router.push(route);
                });
                return link;
              }
    },
    

    【讨论】:

    • 这对我也有用,谢谢。但我希望名称字段单元格可点击,而不是 ID 字段。为此该怎么办?任何想法!
    猜你喜欢
    • 2016-02-16
    • 2021-09-20
    • 2019-10-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-01
    相关资源
    最近更新 更多