Jump to content


Bug v2.6.8: Custom dropdown field not working with callbackColumn

bug dropdown callback column

  • Please log in to reply
No replies to this topic

#1 jw_hultafors

jw_hultafors

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 05 November 2018 - 11:13 AM

Hi,

 

Updated to 2.6.8 today and found that a bug has occured.

For fields using callbackColumn() and fieldType() at the same time does not seem to work (at least for FIELD_TYPE_DROPDOWN).

$crud->fieldType('compared_to_inv_no_diff', GroceryCrud::FIELD_TYPE_DROPDOWN, [
	1 => "No diff",
	0 => "With diff",
]);

$crud->callbackColumn('compared_to_inv_no_diff', function ($fieldValue, $primaryKeyValue) {
	return $this->__callbackBooleanNull($fieldValue, $primaryKeyValue);
});

protected function __callbackBooleanNull($fieldValue, $primaryKeyValue) {
	if ($fieldValue === null) {
		return "<i class=\"fa fa-question\"></i>";
	} else if ($fieldValue == 0) {
		return "<i class=\"fa fa-exclamation-triangle text-danger\"></i>";
	} else if ($fieldValue == 1) {
		return "<i class=\"fa fa-check text-success\"></i>";
	}
}

Any ideas?

Regards

Jonathan

 

EDIT: Should add that I'm using GCE with Laravel and MySQL. The field in the database is a nullable boolean field (TINYINT).







0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users