Skip to content

helpfulrobot/webbuilders-group-silverstripe-limitedrelationsgridfield

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Limited Relations GridField

Adds the ability to limit the number of items in the relationship managed by GridField.

Maintainer Contact

Requirements

  • SilverStripe CMS 3.1.x

Installation

Usage

For many_many relationships simply swap the configuration for the GridField with LRGridFieldConfig_RelationEditor, for example.

//Create a GridField instance with a page length of 10 and a item cound limit of 20
new GridField('MyGridField', 'My GridField', $this->Relationship(), LRGridFieldConfig_RelationEditor::create(10, 20));

For has_many relationships simply swap the configuration for the GridField with LRGridFieldConfig_RecordEditor, for example.

//Create a GridField instance with a page length of 10 and a item cound limit of 20
new GridField('MyGridField', 'My GridField', $this->Relationship(), LRGridFieldConfig_RecordEditor::create(10, 20));

Configuration Options

The LRGridFieldAddExistingAutocompleter component provides a single method that allows changing of the limit, as well this limit can be set as the 3rd parameter to the constructor.

$myLimitedAutoCompleter->setItemLimit(3); //Change the item limit to 3

The LRGridFieldDetailForm component provides a single method that allows changing of the limit, as well this limit can be set as the 2nd parameter to the constructor.

$myLimitedDetailForm->setItemLimit(3); //Change the item limit to 3

About

Adds the ability to limit the number of items in the relationship managed by GridField.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%