ChronoEngine.com homepage

Forums

Fields list in Views type Details List not working

V
vdneut posted Jan 30, 2023 at 18:38
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
G
gix.vax posted Jan 30, 2023 at 22:46
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
V
vdneut posted Jan 31, 2023 at 21:32
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
G
gix.vax posted Feb 2, 2023 at 16:29
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)
V
vdneut posted Feb 3, 2023 at 20:00
Thanks for the extra tips & tricks. Goes into my small manual.
You need to login to be able to post a reply.

2Checkout.com

2CheckOut.com Inc. (Ohio, USA) is an authorized retailer for goods and services provided by ChronoEngine.com