Hey.
I’m running into an issue with the GrafanaUI Plugin
component in NextJS 14 where I’m able to create myDataFrame
and I can get the correct amount of rows to render depending on my values added into each field. But I’m having trouble getting the correct information to render in each Cell. const buildTableData = (members: any[]): DataFrame => {
const hardCodedValue = [
{
id: 1,
email: "mike.kovar@test.com",
last_name: "kovar",
first_name: "mike",
},
{
id: 2,
email: "tony.kovar@test.com",
last_name: "Kovar",
first_name: "Tony",
},
];
const tableFields = [
{
config: {
displayName: "First Name",
},
name: "first_name",
type: FieldType.string,
values: ["Tony", "Mike"],
},
{
config: {
displayName: "Last Name",
},
name: "last_name",
type: FieldType.string,
values: hardCodedValue,
display: displayValue,
},
{
config: {
displayName: "id",
},
name: "id",
type: FieldType.string,
values: hardCodedValue,
display: displayValue,
},
{
config: {
displayName: "Email",
},
name: "email",
type: FieldType.string,
values: hardCodedValue,
display: displayValue,
},
];
return toDataFrame({
name: "Members",
fields: tableFields,
length: 9,
});
};
In that snippet First Name
displays empty cells, which I’d expect. And the other columns that are using this function
const displayValue = async (value: any) => {
"use server";
return <span>{value.first_name}</span>;
};
Are all returning undefined
. I’m assuming that this is expected behavior but I have not been able to find any explanation as to how I can create a display function such that my values display properly. Has anyone had any luck with this?