从使用js-grid创建的tr获取ID,属性路径每次都会更改

问题描述 投票:0回答:1

所以我正在使用js-grid填充通用网格。我有4个可见列和1个隐藏ID列。我试图将每行的唯一ID传递给另一个函数。但是,当我深入研究对象的属性路径时,将使用jquery返回。我需要获取的密钥嵌套在一个密钥中,该密钥似乎在每次返回对象时都会改变。]

Here's the JS grid code...
$("#jsGrid").jsGrid({
        width: "100%",
        height: "25rem",

        autoload: true,
        inserting: false,
        editing: false,
        sorting: false,
        paging: true,
        pageloading: true,

        data: data,

        fields: [
            { name: "ID", type: "text", width: 25, align: "center", visible: false },
            { name: "Date", type: "text", width: 25, align: "center" },
            { name: "Color", type: "text", width: 25, align: "center" },
            { name: "type", type: "text", width: 25, align: "center" },
        { name: "other", type: "text", width: 25, align: "center" }
        ]
});

Here's some sample data...
var data = [
    { "ID": "123", "Date": "3/15/19", "color": "Brown", "type": "something", "other": "7 mins" },
    { "ID": "124", "Date": "3/15/19", "color": "Red", "type": "something", "other": "15 mins" },
    { "ID": "125", "Date": "3/15/19", "color": "Blue", "type": "something", "other": "15 mins" },
    { "ID": "126", "Date": "3/15/19", "color": "Blue", "type": "something", "other": "7 mins" },
    { "ID": "127", "Date": "3/15/19", "color": "Black", "type": "something", "other": "20 mins" },
    { "ID": "128", "Date": "3/15/19", "color": "Gold", "type": "something", "other": "5 mins" },
    { "Date": "TOTAL", "color": "", "type": "", "other": "74 mins"}
];

Here's the code I use to get the <tr> object using console
$(".jsgrid-table > tbody > tr:not('[class*=totalsRow]')");

这是我看到的。更改的一个或多个键在所附的图像中,并以jQuery开头。

enter image description here

所以我正在使用js-grid填充通用网格。我有4个可见列和1个隐藏ID列。我试图将每行的唯一ID传递给另一个函数。但是,当我潜入...

javascript jquery jsgrid
1个回答
1
投票

所以我已经尝试过您的代码。根据您给我的信息,我必须编写自定义方法来实现它。

© www.soinside.com 2019 - 2024. All rights reserved.