Use table generator with data views

I often use the Data View component to provide clean access to a filtered array of results.

However we currently cannot use a data view when generating a bootstrap 5 table.

Because a data view knows the schema of its underlying source, it should be possible to “read through” the data view and use its source schema for use in a table generator.

It’s entirely possible. Unfortunately there’s an bug in Wappler preventing it. To circumvent it, switch to your development build, open the server connect where the root query lives, edit the query (no changes, just open editor), close editor, click save, leave on development server and try again. It should be fine.

I get this all the time

1 Like

Do you have a bug report about this?

Thanks for that. My workaround is to just build off the main source, and then edit the repeat to the data view.

That’s another option. Whatever is easiest at the time. I always default to a DV between the front end and data source. It’s a powerful conduit

We’ve just tested creating a dynamic table using a data view as a data source and we can’t recreate this issue. Can you check if that’s still a problem for you?
If yes, can you share what have you selected in your data view component as an expression for the data source?

Here’s our test:

Data view setup:

Table generator setup:

Hey Teodor, you are correct, it does work in some scenarios, but not others.

Here’s some examples.

Below prices_all and prices_fcl are working, but the rest have now columns in ‘data’:

Here are the data views for those:

        <dmx-data-view id="prices_all" dmx-bind:data="get_prices.data.prices"></dmx-data-view>
        <dmx-data-view id="prices_fcl" dmx-bind:data="get_prices.data.prices.where(`price_type`, 'fcl', '==')"></dmx-data-view>
        <dmx-data-view id="prices_lcl" dmx-bind:data="get_prices.data.prices.where(`price_type`, 'lcl', '==')"></dmx-data-view>
        <dmx-data-view id="prices_road_freight" dmx-bind:data="get_prices.data.prices.where(`price_type`, 'road_freight', '==')"></dmx-data-view>
        <dmx-data-view id="prices_air_freight" dmx-bind:data="get_prices.data.prices.where(`price_type`, 'air_freight', '==')"></dmx-data-view>
        <dmx-data-view id="prices_inland" dmx-bind:data="get_prices.data.prices.where(`price_type`, 'inland', '==')"></dmx-data-view>
        <dmx-data-view id="prices_other_services" dmx-bind:data="get_prices.data.prices.where(`price_type`, 'other_services', '==')"></dmx-data-view>

And here is the server connect that drives the views:

      <dmx-serverconnect id="get_prices" url="/api/prices/get_prices" sockets="true" dmx-param:sort="query.sort" dmx-param:dir="query.dir" dmx-param:q="content.inp_search_prices_fcl.value || content.inp_search_prices_lcl.value || content.inp_search_prices_road_freight.value || content.inp_search_prices_inland.value || content.inp_search_prices_other_services.value"></dmx-serverconnect>

It would seem as though the where clause is triggering the issue, excep that prices_fcl IS working and does have a where clause.

Currently using 5.1.4