Only a value in the table column

Only a value in the table column

Hildeb67Hildeb67 Posts: 77Questions: 21Answers: 1

I use a “Nationality” selection field in my form. This is displayed correctly in the form, but only the value in the table. Here is a code snippet

 }, {
        label: "Nationalität:",
        name: "mitgliederstamm.NATION",
        type: "select"     
    }, {
 
 
    { data: "mitgliederstamm.NATION",  
        "render": function (data, type, row) {
            if (type === 'display') {                
             
            }
            return data;
        },
    }, 
 
 
 
 
Field::inst( 'mitgliederstamm.NATION' )
    ->options( Options::inst()
        ->table( 'nationalitaeten' )
        ->value( 'ID' )
        ->label('Nationalität')            
        ->label( array('NATIONALITAET', 'SPRACHE') )
        ->render( function ( $row ) {
            return $row['NATIONALITAET'].' '.$row['SPRACHE'].'' ;
            } )        
    ),


Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,773Questions: 1Answers: 10,511 Site admin
    Answer ✓

    I presume this is a join - you include a Field for the joined label that you want to show to the end user, and set columns.data to be that for the DataTable.

    If you have a look at this example, you'll see that the form worked on users.site, but the DataTable displays sites.name.

    Allan

  • Hildeb67Hildeb67 Posts: 77Questions: 21Answers: 1

    Great thanks Allan it worked

    Chris

Sign In or Register to comment.