Pivot gird (custom groups) for gird header

Hello everyone,

How can I do this? I tried with Pivot, but I couldn’t make it work. I attached the DB structure and its diagram in the file. What I want to achieve is something like this. By the way, I can do this with a blank app, but I want to use Grid and take advantage of its features.

I also created an HTML template and tried to fill it with Pivot using onScriptInit, but I couldn’t get it to work. It shouldn’t be this difficult, I think. What am I doing wrong, or should I just continue with the Blank App?

Thank you!

– Main Categories Tablosu
CREATE TABLE KetMrp_QP_MainCategories (
CategoryId INT IDENTITY(1,1) PRIMARY KEY,
MainCategoryName NVARCHAR(50) NOT NULL
);

– Sub Categories Tablosu
CREATE TABLE KetMrp_QP_SubCategories (
SubCategoryId INT IDENTITY(1,1) PRIMARY KEY,
CategoryId INT NOT NULL,
SubCategoryName NVARCHAR(50) NOT NULL,
FOREIGN KEY (CategoryId) REFERENCES KetMrp_QP_MainCategories(CategoryId)
);

– Products Tablosu
CREATE TABLE KetMrp_QP_Products (
ProductId INT IDENTITY(1,1) PRIMARY KEY,
K2YasUrunKodu INT NOT NULL,
K1YasK3YasFirinOtomatikYuklemeUrunKodu INT NOT NULL,
AdetNetsisKodu INT NOT NULL,
UrunIsmi NVARCHAR(50) NOT NULL,
UrunIsmiEski NVARCHAR(50) NULL,
UrunGrubu NVARCHAR(50) NULL,
UrunOlculeri NVARCHAR(50) NULL
);

– Units Tablosu
CREATE TABLE KetMrp_QP_Units (
UnitID INT IDENTITY(1,1) PRIMARY KEY,
CategoryID INT NULL,
SubCategoryID INT NULL,
UnitName NVARCHAR(50) NOT NULL,
UnitValue DECIMAL(10,2) NULL,
FOREIGN KEY (CategoryID) REFERENCES KetMrp_QP_MainCategories(CategoryId),
FOREIGN KEY (SubCategoryID) REFERENCES KetMrp_QP_SubCategories(SubCategoryId)
);

– Ara Tablo: Product ve MainCategories’i bağlamak için
CREATE TABLE KetMrp_QP_ProductMainCategories (
ProductMainCategoryId INT IDENTITY(1,1) PRIMARY KEY,
ProductId INT NOT NULL,
MainCategoryId INT NOT NULL,
FOREIGN KEY (ProductId) REFERENCES KetMrp_QP_Products(ProductId),
FOREIGN KEY (MainCategoryId) REFERENCES KetMrp_QP_MainCategories(CategoryId)
);

If there is someone who can help, I would really appreciate it!