Skip to content

Add Select action element to wunderbyte table #78

@georgmaisser

Description

@georgmaisser

We need a generic select element which triggers the execute_action webservice and calls a method which is defined in the wunderbyte_table child class.

This should be done by copying and adapting the logic for the already existing checkbox element.

This Element is currently implemented in

/local/wunderbyte_table/demo.php#tab1name

(in all four tables in the action column, beneath the red and green button).

To implement:

Starting with branch
MOODLE_401_DEV

In the class demo_table.php, line 100, there is the code which includes a checkbox.

The js is in the actionbutton.js.

The input Element itself comes from the mustache template is in component_actionbutton.mustache

The code to add the select should look somehow like this:

$data[] = [
'label' => get_string('checkbox', 'local_wunderbyte_table'), // Name of your action button.
'class' => 'btn btn-success',
'href' => '#', // You can either use the link, or JS, or both.
'iclass' => 'fa fa-edit', // Add an icon before the label.
'id' => $values->id.'-'.$this->uniqueid,
'name' => $this->uniqueid.'-'.$values->id,
'methodname' => 'chooseselectvalue', // The method needs to be added to your child of wunderbyte_table class.
'action element' =>'select',
'selectoptions' => [
'1' => 'option1', // should work both with or without localization
'2' => 'option2',
'3' => 'option3',
]
'data' => [ // Will be added eg as data-id = $values->id, so values can be transmitted to the method above.
'id' => $values->id,
'labelcolumn' => 'username',
]
];

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions