This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
hi there,
how to get item's id in a partial used to display a action button in a back end list column ?
my partial :
a href="<?= Backend::url('author/plugin/nameofcontroller/create_from_course', 99999) ?>" class="btn btn-default btn-xs">new session</a
where the 99999 need to be the dynamic value ( the id of the model of the list item)
seems so simple but .... spent already half day on it :-)
thanks for help
Last updated
If you use the "partial" list-column type, then you have a few variables available to you inside that partial. Namely, $record, $value and $column. What you need is $record. So your partial would be:
<a href="<?= Backend::url('author/plugin/nameofcontroller/create_from_course', $record->id) ?>" class="btn btn-default btn-xs">new session</a>
Also, make sure you set clickable = false in your columns.yaml for this column.
Last updated
Fantastic!
I played a bit with this, but is there also a way to override the row click? I want to create a publish/unpublish switch with a partial.
I want to use the switch to perform an ajax action. The problem is that I also want a (default) row click for loading the update form. Is that possible? So if i click the switch only the ajax handler and elsewhere in the row the update page?
Last updated
Dreqnoid said:
Fantastic!
I played a bit with this, but is there also a way to override the row click? I want to create a publish/unpublish switch with a partial.
You can override the row click on a particular column by setting the list property clickable=false in your list.yaml. For firing off Ajax requests you might wanna read the scripts section here http://octobercms.com/docs/ui/foundation
I want to use the switch to perform an ajax action. The problem is that I also want a (default) row click for loading the update form. Is that possible? So if i click the switch only the ajax handler and elsewhere in the row the update page?
fantastic x 2 :-) thanks a lot pratyushpundir for the response and the bonus, you save our day,
1-6 of 6