October: Unknown built-in list column types

Created on 21 Oct 2016  路  23Comments  路  Source: octobercms/october

Expected behavior

Standard column types number and relation shown in backend list.

Actual behavior

Exception: List column type "[typename]" could not be found.

Reproduce steps

Create model with a single field in columns.yaml:

id:
    label: ID
    #type: number

Create controller that references model in config_list.yaml:
list: $/<path_to_model>/columns.yaml
Observe exception in controller's backend list.

October build

375 edge

Critical Completed Bug

Most helpful comment

It seems like a common enough pitfall, added some logic to handle it in the next build (ee2dd78b3dcd0560c8aecbb5ab51ac5860846d20)

All 23 comments

+1 same problem

Hum, it works fine for me...
Just to be sure, you are making a normal list with only the id field from your table?

But I have the 365 build, don't know if you wrote wrong the 375 or I am behind in the updates :P

+1 same problem

Fixed in Build 376+

Not for relation column:
List column type "relation" could not be found.

Can you paste the YAML that uses type: relation, I'm not sure it's a thing.

    relation: groups
    select: name

This one chokes:

    updated_by:
        label: User
        type: relation
        relation: user
        select: login
        sortable: true

Change to

    updated_by:
        label: User
        relation: user
        select: login
        sortable: true

The error is correct, there is no _type_ called relation, there is an option called _relation_ though.

Ok, but I have "type: relation" all over the list definitions - it probably was documented somewhere in the past (can't find it in the docs right now).
Not really a problem global search&replace in the project wouldn't solve.

It seems like a common enough pitfall, added some logic to handle it in the next build (ee2dd78b3dcd0560c8aecbb5ab51ac5860846d20)

Soft fail is clever - it nudges us toward using relations AND proper column types, example:

relation: signups_count
type: number

I just had the same failure on list column type "html" after the last update.
It used to work fine until last update.
I had in yaml:

sound:
        label: 'prove.tests::lang.tests.situation_audio'        
        type: partial
        sortable: false

and in my model file:

public function getSoundAttribute(){
        $question = Question::find($this->id);   
        if ($question->situation_audio)
            return '<audio src="'. MediaLibrary::url($question->situation_audio) .'" controls>
                    <div class="media-player-fallback panel-embedded">Your browser doesn\'t support HTML5 audio.</div>
                </audio>';
        else 
            return 'No audio assigned';
    }

Now it breaks with the same error. Unknown column type "html". True it's not in the docs, but I picked it up from somewhere before.

I fixed my issue by replacing type 'html' with type 'partial' and getting the same result with passing needed variables to my partials.

Damn, not sure where these random types came from. AFAIK the html type never existed. Perhaps create a new issue for the remaining problem.

There is no issue, I replaced my "html" type with "partial" type and adapted the code.

are we sure the html type never existed - I've had to pick up an existing project that has type: html all over the place

How old is your existing project? It hasn't existed since at least after Stable was launched June of last year if it ever existed in the first place.

@virtualLast @LukeTowers yes it existed before I was returning to one of my old plugins and got this error "List column type "html" could not be found."

And I'm pretty sure it worked fine at least a year ago so definitely it existed before :)

So how can we get around the error? Is there some documentation? I appear to have several custom plugins with partials in the Models folder and the configs all use type: html.

use type: partial instead

Hi there, I'm getting this error

"List column type "relation" could not be found. Type: relation is not supported, instead use the relation property to specify a relationship to pull the value from and set the type to the type of the value expected."

This occurred once permission for category is added. The blog category can't seem to operate well.

I'm not fully sure what am I supposed to do. Your assistance is much appreciated.

@naaidu You cannot use type: relation to use a relation for a column value, you must instead use relation: <name>, substituting <name> with the name of the related model in the model you are using for the list. You can find more details on the best practices of this here: https://octobercms.com/docs/backend/lists#column-relation.

Hey @bennothommo ... from my observation. Most of the them are in the relation: naming convention. The problem started since I used a plugin called blogprotect.

Was this page helpful?
0 / 5 - 0 ratings