Jump to:

23369 Posts in 18155 Topics by 2863 members

General Questions

SilverStripe Forums » General Questions » Grid-Field Buttons?

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

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

Page: 1
Go to End
Author Topic: 161 Views
  • Micro
    Avatar
    Community Member
    1 Post

    Grid-Field Buttons? Link to this post

    I am following the example here about gird-fields. My question is why is there a button on create on each of the columns? How would I get rid of it and have sortable columns instead?

    http://doc.silverstripe.org/framework/en/reference/grid-field

    This is the code from the example page. When displayed each column has a button above it that links to a non-existent page. How do I get rid of the buttons?

    public function AllPages() {
    $gridField = new GridField('pages', 'All pages', SiteTree::get());
    $dataColumns = $gridField->getConfig()->getComponentByType('GridFieldDataColumns');
    $dataColumns->setDisplayFields(array(
    'Title' => 'Title',
    'URLSegment'=> 'URL',
    'LastEdited' => 'Changed'
    ));
    return new Form($this, "AllPages", new FieldList($gridField), new FieldList());
    }

    Attached Files
  • Willr
    Avatar
    Forum Moderator
    5489 Posts

    Re: Grid-Field Buttons? Link to this post

    You can manipulate the GridField through the GridFieldConfig system. http://doc.silverstripe.org/framework/en/reference/grid-field#configuration has an overview of how it works. To add sortable, you'll need a module like https://github.com/ajshort/silverstripe-gridfieldextensions which adds sortable rows.

    161 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.