21309 Posts in 5738 Topics by 2603 members
General Questions
SilverStripe Forums » General Questions » Basic Gridfield + Sortable + Pagination Example SilverStripe3 ss3
General questions about getting started with SilverStripe that don't fit in any of the categories above.
Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 562 Views |
-
Basic Gridfield + Sortable + Pagination Example SilverStripe3 ss3

10 August 2012 at 9:01pm Last edited: 10 August 2012 9:02pm
Hi, I see many question about using the GrildField & sortable module , so here is an example of how to get the working (tesed on SS3.0.1):
download the files & see the example , I provided a basic template file too so you can give it a quick drive test ;)Note that you will need to download the Sortable Module from : https://github.com/UndefinedOffset/SortableGridField
-
Re: Basic Gridfield + Sortable + Pagination Example SilverStripe3 ss3

31 August 2012 at 2:15am
Hi: for auto sorting of object when adding new items, you need to add this code to your Object , for example:
if Gallery has_many GalleryImages , add this code on the GalleryImages class :function onBeforeWrite() {
parent::onBeforeWrite();
if (!$this->SortID) {
$this->SortID = $this->getNextSortID();
}
}function getNextSortID() {
$getDataList = $this->SGallery()->Images();
if (!$getDataList || $getDataList->Count() == 0) {
return NULL;
} else {
return $getDataList->first()->SortID + 1;
}
}
PM me on the IRC if you have any questions -
Re: Basic Gridfield + Sortable + Pagination Example SilverStripe3 ss3

31 August 2012 at 2:36am
Shouldn't have to manually auto increment the number SortableGridField detects this the next time the GridField is displayed. It will not update if you're still in the Edit/Add Form.
-
Re: Basic Gridfield + Sortable + Pagination Example SilverStripe3 ss3

5 September 2012 at 12:35am
yep, its fixed now.. I guess I had an old copy of the module . as of 4/9/12 the module will take care of incrementing
| 562 Views | ||
|
Page:
1
|
Go to Top |


