1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

  2. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

Creating Kendo Treelist with data from 2 rbf_selectQuery

Discussão em 'PSDN - Forum' iniciado por Bernard Moeskops, Julho 18, 2019.

  1. Hello,

    I'm trying to create a Kendo Treelist for my Rollbase portal but I'm running into some difficulties. I want the object to consist of 2 datasources combined, with a hierarchy between them. The object consists of objects and activities. One (sub)object can hold objects or activities. The problem is that I am able to create the correct dataobject, but since there are 2 queries the data is already processed at the first query and therefor incomplete.

    Extra explanation: console.log(object); spits out the correct object, but Chrome Devtools notifies me that the value was evaluated only just know. Meaning that the asynchronous object is processed after the tree is generated. The options.success passed the object at the time the first query completed.

    Code snippet from the query inside the Datasource => Transport => read():

    rbf_selectQuery("SELECT name,id,Ppm_objecten,'object' FROM pm_objecten", 2000, async function(values) {
    var arr = values;
    if (values.length > 0) {
    values.forEach(async (item) => {
    await rbf_selectQuery("SELECT name,id,R82743 AS Ppm_objecten,'activiteit' FROM pm_activiteit WHERE R82743=" + item[1], 2000, async function(values2) {
    values2.forEach(async (item2) => {
    await arr.push(item2);
    });
    });
    });
    }
    var length = arr.length;
    options.success({
    total: length,
    data: arr
    });
    });

    At data: arr the object is pushed with only the values from the first query, so the pm_objecten. As you can see I've already tried to make it an async function and await the result.

    Does anyone know how to create the full object before sending it to the Kendo TreeList?

    Thanks for helping!

    Continue reading...

Compartilhe esta Página