justpy-org / justpy

An object oriented high-level Python Web Framework that requires no frontend programming
https://justpy.io
Apache License 2.0
1.22k stars 96 forks source link

db_test tutorial example - table selection does not work #467

Closed WolfgangFahl closed 2 years ago

WolfgangFahl commented 2 years ago

https://justpy.io/grids_tutorial/database/ is now available in the examples/tutorial directory and automatically downloads the database as outlined in #466. The first table is shown but the selection does not work: grafik grafik

The /city route works grafik

elimintz commented 2 years ago

I think I see the problem. The caching mechanism for ag-grid and is probably causing this issue. I'll work on this.

WolfgangFahl commented 2 years ago

This is what the javascript debugger says:

RangeError: Maximum call stack size exceeded
    at Object.get [as justpyComponents] (vue.js:2:7284)
    at pn.get [as justpyComponents] (vue.js:2:28307)
    at Function.entries (<anonymous>)
    at a.evaluate_formatters (aggrid.js:15:51)
    at a.evaluate_formatters (aggrid.js:19:26)
    at a.evaluate_formatters (aggrid.js:19:26)
    at a.evaluate_formatters (aggrid.js:19:26)
    at a.evaluate_formatters (aggrid.js:19:26)
    at a.evaluate_formatters (aggrid.js:19:26)
    at a.evaluate_formatters (aggrid.js:19:26)
WolfgangFahl commented 2 years ago
 evaluate_formatters(def) {
            if (Array.isArray(def)) {
                for (const element of def) {
                    this.evaluate_formatters(element);
                }
            } else if (typeof def == "object" && def !== null) {
                for (const [key, value] of Object.entries(def)) {
                    if (key.toLowerCase().includes('formatter')) {
                        eval('def[key] = ' + def[key]);
                    }
                    this.evaluate_formatters(value);
                }
            }
        },

there is a cut&paste copy version of this in chartjp.js

elimintz commented 2 years ago

Yes, and it does not work for ag-grid. At this stage I recommend removing or commenting out line https://github.com/justpy-org/justpy/blob/master/justpy/templates/js/aggrid.js#L35 until we can revisit this. The example will work then.

WolfgangFahl commented 2 years ago

closing for the time being