harvs1789uk

Would mean $Data = ArrayList instead of DataList

harvs1789uk
  1. $Data = Draw::get()->filter(array(
  2. 'ActivateDraw' => "1",
  3. 'FinishDate:GreaterThan' => $this->getTodaysDate()->FullDateFormat,
  4. 'FinishTime:GreaterThan' => $this->getTodaysDate()->Time
  5. ))
  6. ->filterByCallback(function($item, $list) { return true; });
harvs1789uk

That was my example? 😄

LiamC

Hi Sorry I still cant get it working.. 😕 am I doing something wrong?

  1. $Data = Draw::get()->filter(array(
  2. 'ActivateDraw' => "1",
  3. 'FinishDate:GreaterThan' => $this->getTodaysDate()->FullDateFormat,
  4. 'FinishTime:GreaterThan' => $this->getTodaysDate()->Time
  5. ))->filterByCallback(function($item, $list) { return true; });
  6.  
  7.  
  8. $Data1 = CustomDraw::get()->filter(array(
  9. 'ActivateDraw' => "1",
  10. 'FinishDate:GreaterThan' => $this->getTodaysDate()->FullDateFormat,
  11. 'FinishTime:GreaterThan' => $this->getTodaysDate()->Time
  12. ))->filterByCallback(function($item, $list) { return true; });
  13.  
  14. $Data3 = BestsPickDraw::get()->filter(array(
  15. 'Draw.ActivateDraw' => "1",
  16. 'FinishDate:GreaterThan' => $this->getTodaysDate()->FullDateFormat,
  17. 'FinishTime:GreaterThan' => $this->getTodaysDate()->Time
  18. ))->filterByCallback(function($item, $list) { return true; });
  19.  
  20. $Data->merge($Data1);
  21. $Data->merge($Data3);
  22. $Sort = $Data->sort('FinishDate ASC');
  23. return $Sort;

harvs1789uk

Before the penultimate line which does the sort, does $data contain what you are expecting? Maybe loop over each entry and print out some key values to be sure?

LiamC

yes it contains each item, it attempts to sort it but not based on the finish date

harvs1789uk

Maybe you need something like:

$Data = $data->merge($Data1);

Can't remember if merge() is one of the methodss which never updates the original or not

harvs1789uk

I presume it's nothing to do with ->sort(["FinishDate" => "ASC"); being required?

harvs1789uk

I suspect $list isn't the merged combination of 3 DataLists as an ArrayList which you expect, hence ->sort() not working as planned

harvs1789uk

I have always used filterByCallback(function($item, $list) { return true; }) as a hack to turn a DataList into an ArrayList

harvs1789uk

@LiamC I can't remember for certain, but based on the method name toArray() I suspect that returns an array, not an ArrayList ?

harvs1789uk

OK.... Referencing the rest of the directory path/namespace works.

Including Layout means you don't get any of the 'chromeofhttp://Page.ss` but removing it you do:

  1. return $this->renderWith(
  2. ['Nexus/Baybay/WorkPage', 'Page']
  3. );

Yields the result I wanted, matching return $this->render();

harvs1789uk

Have tried with and without Layout/, same results, anyidea what I am doing wrong?

harvs1789uk

Using just render() as a return value works:

  1. return $this->customise([
  2. 'Subtitle' => 'Work...',
  3. 'Work' => $work
  4. ])->render();

So I don't think I have any errors re: name spacing and theme folder structure?