コード例 #1
1
 /**
  * Similar to {@link groupBy()}, but returns
  * the data in a format which is suitable for usage in templates.
  *
  * @param  string $index
  * @param  string $children Name of the control under which children can be iterated on
  * @return ArrayList
  */
 public function GroupedBy($index, $children = 'Children')
 {
     $grouped = $this->groupBy($index);
     $result = new ArrayList();
     foreach ($grouped as $indVal => $list) {
         $list = GroupedList::create($list);
         $result->push(new ArrayData(array($index => $indVal, $children => $list)));
     }
     return $result;
 }
コード例 #2
0
 public function testTotalItems()
 {
     $list = GroupedList::create(ArrayList::create(array(ArrayData::create(array('Name' => 'AAA', 'Number' => '111')), ArrayData::create(array('Name' => 'BBB', 'Number' => '111')), ArrayData::create(array('Name' => 'AAA', 'Number' => '222')), ArrayData::create(array('Name' => 'BBB', 'Number' => '111')))));
     $this->assertEquals(4, $list->TotalItems());
 }