#6052·october

Dropdown field in datatable save value (not id)

Author: EeesbksbkCreated Jun 6, 2026Updated Jul 7, 2026

YAML:

board:
        label: Board
        searching: true
        btnAddRowBelowLabel: Add
        recordsPerPage: 8
        height: 266
        type: datatable
        span: row
        spanClass: col-8
        columns:
            name:
                title: name
                type: string
            type:
                title: type
                type: dropdown

MODEL:

public function getDataTableOptions()
{

	$boards = Board::with('board_type')->get();
	$options = $boards->pluck(
			function ($board) {
				return $board->name . ' - ' . $board->board_type->name;
			},
			'id'
	)->all();
		

	return $options;
}

Field type in Db save as name - board-type. How save as id ??

PS: In version 4.1.9 this worked (save id), v4.2.24 - not worked (save name - type)