⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

callbackColumn not working for certain type of fields



cletourneau
  • profile picture
  • Member

Posted 06 October 2017 - 20:17 PM

I just tested callbackColumn for some type of fields (MySQL), here's my code :

        $this->crud->setTable('my_table')
            ->setSubject('a line')
            ->callbackColumn('col_integer', function ($value, $row) {
                return "<a href='/integer/" . $value."' target='blank'>$value</a>";
            })
            ->callbackColumn('col_decimal', function ($value, $row) {
                return "<a href='/decimal/" . $value."' target='blank'>$value</a>";
            })
            ->callbackColumn('col_varchar', function ($value, $row) {
                return "<a href='/varchar/" . $value."' target='blank'>$value</a>";
            })
            ->callbackColumn('col_date', function ($value, $row) {
                return "<a href='/date/" . $value."' target='blank'>$value</a>";
            })
            ->callbackColumn('col_datetime', function ($value, $row) {
                return "<a href='/datetime/" . $value."' target='blank'>$value</a>";
            })
            ->callbackColumn('col_bool', function ($value, $row) {
                return "<a href='/bool/" . $value."' target='blank'>$value</a>";
            })
            ->displayAs('col_integer', 'Integer number')
            ->displayAs('col_decimal', 'Real number')
            ->displayAs('col_varchar', 'Character array')
            ->displayAs('col_date', 'Date')
            ->displayAs('col_datetime', 'Date and time')
            ->displayAs('col_bool', 'Boolean choice')
            ->editFields([
                'col_integer',
                'col_decimal',
                'col_varchar',
                'col_date',
                'col_datetime',
                'col_bool'
            ])
        ;

Here's my result :

 

col_integer : working

col_decimal : working

col_varchar : working

col_date : not working (nothing is displayed)

col_datetime : not working (nothing is displayed)

col_bool (tinyint) : working

 

Could you confirm the problem?

 

Thanks

 


web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 10 October 2017 - 12:29 PM

Hello @cletourneau,

 

I confirm that this is a bug. This is a more complicated (and different) bug from the one mentioned here: /topic/4052-callbackeditfield-not-working-for-mysql-bool-tinyint1/ so I can't solve it straight away! I did create a ticket to my backlog so I can find a solution to the upcoming releases.

Regards

Johnny


web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 12 October 2017 - 19:51 PM

Hello @cletourneau,

 

This is now fixed and it will be released with the new version 2.3.6 of Grocery CRUD Enterprise.

 

Regards

Johnny