1

I am working with the grid.js library but when adding data to the table I don't see rowId appear, so I can't process the color change for the row and get the row's data by clicking on the "bi-pencil" icon via rowId (event onClick). Now I want to add rowId for 1 row. Help me. Thanks

    columns: [
      {
        id: "update",
        name: "update",
        width: "3%",
        align: "center",
        sort: {
          enabled: false,
        },
        formatter: (cell, row, column) => {
          rowObject = {
            Id: row.cells[6].data,
            Name: row.cells[2].data,
          };
          return gridjs.html(
            `<i class="bi bi-pencil-square fs-5" role="button" onclick='setValue(${JSON.stringify(
              rowObject
            )})'></i>`
          );
        },
      },
      {
        id: "short-name",
        name: "Short name",
        width: "47%",
      },
      {
        id: "full-name",
        name: "Full name",
      },
      {
        id: "id",
        name: "id",
        hidden: true,
      },
    ],
    sort: true,
    pagination: {
      limit: 16,
    },
    server: {
      method: "GET",
      url: "/getData",
      then: function (data) {
        loadDataCombobox(data.records);
        return data.records.map(function (col) {
          return [
            null,
            col.shortName,
            col.fullName,
            col.id,
          ];
        });
      },
    },
  }).render(document.getElementById("area-table"));
}

0 Answers0