Forums

Fields list in Views type Details List not working

vdneut 30 Jan, 2023
Hi,
Instead of using the 'Inlude all provider fields" option I would like to use specific Model.field:Label pairs in the Fields list in Views type Details List.
So, turned off option 'Inlude all provider fields" and then added some fields in the Fields list, like:
Article.title:Title
Article.introtext:Intro

The result is a page with the lables, but no values.
I tested the Demo: Article relations demo, out of the box and also that one does not work. It should show: title:<div class="ui label red">Article title</div>
But it doesn't.

My conclusion would be, there's something wrong with the Details List view type.
But if there's something that I do not understand or made a misstake, please let me know how I can solve it.

Kind regards,
Nico
gix.vax 30 Jan, 2023
Is your data provider ok?

example
IN EVENT
event name index
{fn:read_article} (you must create this in function, read article table and have model called Article)
{view:my_list}

IN VIEW
name: my_list
data provider : {var:read_article}
field list
Article.title:title
Article.introtext:intro

in function
create a database read called "read_article" with model named Article
vdneut 31 Jan, 2023
Thanks, this helped to solve it.

In terms of your example, I had an extra reference to the model in the data provider

IN VIEW
name: my_list
data provider : {var:read_article.Article}
field list
Article.title:title
Article.introtext:intro

Once I removed the reference to the model, it worked.
Why it worked? I have no idea, as the model reference can be used. I stole it from the 'Article relations demo', View, article_details, data provider field.
Even more bizar, If you remove the .Article part in the demo, it breaks.

I will study some more on CC6...

Thanks again and regards,
Nico
gix.vax 02 Feb, 2023
yes, data provider is the entire read_data not the model of the read data
Is in list that you point to model_name.fieldname

some tricks
if you want to ponit to a filed in a row of a list (with a button in the row for example) you have to use the synthax
{var:mylist_name.row,model_name.field_name}
eg
{var:read_article.row.Article.introtext}

pay attention
if you modify your table in mysql (or db you are using) and sometimes when you modify your model
use the "clear cache"function of chronoforms and CC6 (both)

You can find clear cache on top of list of your CC6 and CF6 forms, (click on three dots icon to show menu item clear cache)
vdneut 03 Feb, 2023
Thanks for the extra tips & tricks. Goes into my small manual.
You need to login to be able to post a reply.