是否有类似于Angular中的group by功能,可以将这种分组头下的JSON数据进行分组。
外部列表按组对数据进行排序,然后是该组的内部列表数据项,如果可以对这些数据进行分组,则无法理解此数据。
var data = [
{
"id":23,
"name":"Fun Run (Pre-Registration Required)",
"date":"Wednesday Nov 12",
"group_header":"Sessions from 7:00 am to 1:45 pm"
},
{
"id":24,
"name":"Breakfast",
"date":"Wednesday Nov 12",
"group_header":"Sessions from 7:00 am to 1:45 pm"
},
{
"id":25,
"name":"Opening Address",
"date":"Wednesday Nov 12",
"group_header":"Sessions from 7:00 am to 1:45 pm"
},
{
"id":25,
"name":"abc",
"date":"Wednesday Nov 12",
"group_header":"Sessions from 1:00 pm to 9:00 pm"
},
{
"id":26,
"name":"xyz",
"date":"Wednesday Nov 12",
"group_header":"Sessions from 1:00 pm to 9:00 pm"
},
{
"id":26,
"name":"xyz",
"date":"Wednesday Nov 12",
"group_header":"Sessions from 8:45 am to 2:00 pm" //notice a different header
},
{
"id":26,
"name":"xyz",
"date":"Wednesday Nov 12",
"group_header":"Sessions from 1:30 pm to 11:00 pm" //another different header
}
]
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<ul>
<li>Sessions from 7:00 am to 1:45 pm
<ul>
<li>Fun Run (Pre-Registration Required)</li>
<li>Breakfast</li>
<li>Opening Address</li>
</ul>
</li>
<li>Sessions from 1:00 pm to 9:00 pm
<ul>
<li>abc</li>
<li>xyz Address</li>
</ul>
</li>
<li>another custom header (no pattern to it) - sessions from 10 am to 5 pm
<ul>
<li>abc</li>
<li>xyz Address</li>
</ul>
</li>
</ul>