Tables doesn't appear in the datasource tab

Posted by: Fabrice.Mainguene on 7 May 2026, 9:20 am EST

  • Posted 7 May 2026, 9:20 am EST

    I’m using GC.Data.DataManager() to add tables, but when I go to the “Data Sources” tab, the tables don’t appear.

    What do I need to do to make them appear?

    [code]// Création du DataManager

    const dataManager = new GC.Data.DataManager();

    // Boucle sur toutes les dataclasses 4D
    for (const dc of catalog.dataClasses) {
    
        const tableName = dc.name;
    
        // Création de la table dans le DataManager
        dataManager.addTable(tableName, {
    
            remote: {
    
                // READ
                read: async function (params) {
    
                    const skip = params.skip || 0;
                    const take = params.take || 100;
    
                    let url =
                        `http://localhost:8080/rest/${tableName}` +
                        `?$skip=${skip}` +
                        `&$top=${take}`;
    
                    // TRI
                    if (params.sort &&
                        params.sort.length) {
    
                        const orderBy =
                            params.sort
                                .map(s =>
                                    `${s.field} ${s.dir}`
                                )
                                .join(",");
    
                        url +=
                            `&$orderby=${orderBy}`;
                    }
    
                    // FILTRE SIMPLE
                    if (params.filter &&
                        params.filter.field) {
    
                        url +=
                            `&$filter=${params.filter.field}="${params.filter.value}"`;
                    }
    
                    const response =
                        await fetch(url);
    
                    const json =
                        await response.json();
    
                    return {
                        data: json.__ENTITIES,
                        totalCount:
                            json.__COUNT ||
                            json.__ENTITIES.length
                    };
                },
    
                // CREATE
                create: async function(entity) {
    
                    const response = await fetch(
                        `http://localhost:8080/rest/${tableName}`,
                        {
                            method: "POST",
                            headers: {
                                "Content-Type":
                                    "application/json"
                            },
                            body: JSON.stringify(entity)
                        }
                    );
    
                    return await response.json();
                },
    
                // UPDATE
                update: async function(entity) {
    
                    const response = await fetch(
                        `http://localhost:8080/rest/${tableName}(${entity.ID})`,
                        {
                            method: "PATCH",
                            headers: {
                                "Content-Type":
                                    "application/json"
                            },
                            body: JSON.stringify(entity)
                        }
                    );
    
                    return await response.json();
                },
    
                // DELETE
                destroy: async function(entity) {
    
                    await fetch(
                        `http://localhost:8080/rest/${tableName}(${entity.ID})`,
                        {
                            method: "DELETE"
                        }
                    );
                }
            }
        });
    
        console.log(
            `Table créée : ${tableName}`
        );
    }
    
    return dataManager;[/code]
    
  • Posted 8 May 2026, 2:51 am EST - Updated 8 May 2026, 2:56 am EST

    Hi,

    Thank you for sharing your code — we were able to reproduce the issue and identify the root cause.

    ROOT CAUSE

    The tables are not appearing in the Designer’s “Data Sources” tab because of the DataManager instance being used:

    // This creates a standalone, detached instance

    const dataManager = new GC.Data.DataManager();

    When you instantiate DataManager this way, it is completely independent of the SpreadJS workbook. The Designer has no reference to it, so any tables registered on this instance are invisible to the “Data Sources” tab — even though they work correctly in isolation.

    THE FIX

    You need to retrieve the DataManager that is bound to the workbook itself, using:

    // This returns the workbook-bound instance the Designer reads from

    const dataManager = spread.dataManager();

    This is a single-line change, and the rest of your code — including your remote read/create/update/destroy functions and your dataClass loop — can remain exactly as written.

    We have attached a working sample that incorporates the fixe while keeping your original code structure — including the dataClass loop, and the remote read/create/update/destroy pattern — as intact as possible.

    The live API calls have been replaced with setTimeout-based simulations so the sample runs without any backend dependency.

    Sample: Sample.zip

    Gif:

    Best regards,

    Priyam

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels