Setformatter doesn`t work with fields from leftjoin

Setformatter doesn`t work with fields from leftjoin

jgcaudetjgcaudet Posts: 82Questions: 7Answers: 0
edited May 2016 in DataTables 1.10

Hi Allan
Why it doesn´t work this :

$editor = Editor::inst( $db, 'partsdetail', 'pardetid')
    ->fields(...
        Field::inst( 'partsdetail.modifiedby' )
                    ->setFormatter( function($val, $data, $field) {
                            $pModifiedby = "allan" ;
                            return $pModifiedby;
                                                    
                      }), ....
        Field::inst( 'parts.customer' )->set(false), ....

    ->leftJoin( 'parts', 'parts.parid', '=', 'partsdetail.parid' )

Simply doesn´t modify 'partsdetail.modifiedby' value.
Thanks

Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

This question has an accepted answers - jump to answer

Answers

  • jgcaudetjgcaudet Posts: 82Questions: 7Answers: 0
    edited May 2016
    $editor = Editor::inst( $db, 'partsdetail', 'pardetid')
        ->fields(...
            Field::inst( 'partsdetail.modifiedby' )
                        ->setFormatter( function($val, $data, $field) {
                                $pModifiedby = "allan" ;
                                return $pModifiedby;
                          }), ....
            Field::inst( 'parts.customer' )->set(false), ....
        ->leftJoin( 'parts', 'parts.parid', '=', 'partsdetail.parid' )
    

    Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

  • allanallan Posts: 61,771Questions: 1Answers: 10,112 Site admin
    Answer ✓

    Is partsdetail.modifiedby being submitted by the client-side? If not, you need to use the Field->setValue() method to set the value (the formatter is used to transform one form into another).

    Allan

This discussion has been closed.