Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Check boxes to select records in summary table of ModelAdmin

Go to End

9 Posts   2685 Views


Forum Moderator, 267 Posts

7 December 2010 at 12:57pm

Hi all,
I have been going nuts trying to work this out and have scoured the forums looking for any code or other people that have come up against this same problem.

Basically I have a client who I have built a sales logging system for using SS, there is a Sale dataobject which holds a bunch of information about the sale including a "Status" (Enum) which allows the following statuses: Pending, Cancelled, Active, Invoiced.

On the front end I have everything running so his sales reps can log the sales they make, the reps themselves change the Sale dataobject status to "active".
My client then would go and in the CMS using the ModelAdmin interface I setup for him, find the Active Sales, and mark them as "Invoiced" when he performs his accounting processes.

This was happening on a record by record basis, i.e. he opened the record in ModelAdmin, changed the dropbox, saved and clicked back.

Problem being he now wants to have a checkbox in the ModelAdmin summary table that he can just select more than one record at a time and select a button to mark ALL those records as "Invoiced" at once.

I could pretty easily sort this out on the front end for him but he has explicitly requested that this feature be included into the CMS (ModelAdmin).

Has anyone any idea about how to achieve this or at least point me in the right direction about how to add extra columns to the ModelAdmin summary table and be able to submit these to a method either serverside or ajax which I can then perform some action against only the selected rows?

Doing my head in :P

Thanks in advance.


Forum Moderator, 1899 Posts

7 December 2010 at 9:41pm

How about....

1)adding a cast to the summary fields ([]=cast#casting) to display a check box (or an image of a check box) that has knowledge of the row's id
2)add an onclick to this that performs an ajax request to change the state of the row (using the ID)
3)upon success this then updates the checkbox accordingly (with unchecking on failure if using a checkbox or changing the image if using images for your checkbox)

hope this helps...

James Bolitho

Community Member, 33 Posts

7 March 2012 at 4:47am


I know this is an old post but I would like to do something similar. So far I have managed to get checkboxes to appear for each record by adding the following code to my Model Admin code:

class ProductAdmin extends DataObjectAsPageAdmin {
    public static $managed_models = array(
    static $url_segment = 'products';
    static $menu_title = 'Products';
    public static $record_controller_class = "ProductAdmin_RecordController";
    public static $collection_controller_class = "ProductAdmin_CollectionController";
class ProductAdmin_RecordController extends ModelAdmin_RecordController {

class ProductAdmin_CollectionController extends ModelAdmin_CollectionController {
	function getResultsTable($searchCriteria) { 
		$tableField = parent::getResultsTable($searchCriteria);
		$tableField->MarkableTitle = "Select";
		$tableField->Markable = true;
		return $tableField;	

Now I would like to add a delete button at the bottom of the table list field in order to allow deletion of all the selected items. This is where I have got stuck so would be grateful if anyone has any code they would like to share or point me in the right direction.




Community Member, 96 Posts

17 March 2012 at 5:47am


I have the same issue. I think we must do something like this

But I can´t figure out, how to create a button to the summary field. With the function getCMSActions() we can create a button within the DataObject class, but the button must be create within the ModelAdmin, I think.

Did you already find a solution, Jim?


Community Member, 175 Posts

20 March 2012 at 8:08pm


if you need to modify modeladmin you may want to read this article:


Community Member, 27 Posts

23 December 2014 at 11:20am

Just a note for future googlers: I just made a module for this.

It would be easy to implement what Cam was originally asking about using it.


Forum Moderator, 267 Posts

23 December 2014 at 11:31am

Nice one mark :) Wow that was a number of years ago!


Community Member, 27 Posts

23 December 2014 at 11:35am

Ha. It was indeed, but this was one of the top results from Google when I was looking for something already built so I assume others will find it the same way. I'm surprised there's not more demand for that functionality actually. It seems like a really common pattern.

Go to Top