Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Select action element to wunderbyte table #78

Open
georgmaisser opened this issue Feb 1, 2025 · 0 comments
Open

Add Select action element to wunderbyte table #78

georgmaisser opened this issue Feb 1, 2025 · 0 comments
Assignees

Comments

@georgmaisser
Copy link
Contributor

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',
]
];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants