A few days ago I consulted about bugs when querying a sqlite and now I'm lost on how to incorporate the data provided by the sqlite query to a list in qooxdoo.
//variable= [{"pajarillo": "comsan", "conteo": 1}, {"pajarillo": "eursco1", "conteo": 1}, {"pajarillo": "mutswa", "conteo": 1}, {"pajarillo": "blared1", "conteo": 8}, {"pajarillo": "carcro1", "conteo": 11}, {"pajarillo": "tawowl1", "conteo": 3}, {"pajarillo": "commoo3", "conteo": 1}, {"pajarillo": "houspa", "conteo": 16}, {"pajarillo": "humvoc", "conteo": 2}, {"pajarillo": "eurgol", "conteo": 1}, {"pajarillo": "whiwag", "conteo": 14}, {"pajarillo": "grywag", "conteo": 5}, {"pajarillo": "belmin1", "conteo": 1}, {"pajarillo": "eurbla", "conteo": 5}, {"pajarillo": "comchi1", "conteo": 4}, {"pajarillo": "rocpig", "conteo": 2}, {"pajarillo": "cowpig1", "conteo": 1}, {"pajarillo": "eurrob1", "conteo": 32}, {"pajarillo": "watrai1", "conteo": 1}, {"pajarillo": "firecr1", "conteo": 19}, {"pajarillo": "goldcr1", "conteo": 5}, {"pajarillo": "sonthr1", "conteo": 1}];
var win = new qx.ui.window.Window("Detectadas");
win.setWidth(300);
win.setHeight(200);
win.setShowMinimize(false);
var composite = new qx.ui.container.Composite();
win.setLayout(new qx.ui.layout.VBox( 5));
win.setShowStatusbar(true);
win.setStatus("Aves detectadas con BirdNet");
win.open();
var atom = new qx.ui.basic.Atom(
"Listado de aves detectadas con BirdNet");
var oneList = new qx.ui.form.List();
oneList.set({ height: 280, width: 150, selectionMode: "one" });
const req = new qx.io.request.Xhr("http://__:8081/getData");
req.send();
req.addListener("success", function(e)
{
const resp = e.getTarget();
variable= resp.getResponse();
console.log(variable);
win.setStatus( "Consulta completada.");
oneList.set({ height: 280, width: 150, selectionMode: "one" });
var tmp= [{ "pajarillo": "", "conteo": ""} ];
var model__lista_empresas = qx.data.marshal.Json.createModel( tmp);
var controller__lista_empresas = new qx.data.controller.List( model__lista_empresas, oneList, "pajarillo", "conteo");
controller__lista_empresas.setModel( qx.data.marshal.Json.createModel( variable));
}, this);
/*
var tmp= [{ "pajarillo": "", "conteo": ""} ];
var model__lista_empresas = qx.data.marshal.Json.createModel( tmp);
var controller__lista_empresas = new qx.data.controller.List( model__lista_empresas, oneList, "pajarillo", "conteo");
controller__lista_empresas.setModel( qx.data.marshal.Json.createModel( variable));
*/
win.add( composite);
win.add( atom);
win.add( oneList);
this.getRoot().add(win, {left:20, top:20});
win.open()
The question is that if I copy and put as a variable the response from the data server (sqlite), in the list I can see the response list. But if I use the response from the server directly, I get error.
To say that I am a novice in this and I thank you for your patience.
Best regards.
Translated with www.DeepL.com/Translator (free version)
I've given it a lot of thought but not the right one, it's clear. If you can help me I thank you.