data table to show only category totals

和自甴很熟 提交于 2019-12-11 05:39:14

问题


I'm trying to implement highcharts and i need a html table for my data source.

This is my view. When I bind my data table to this view, it shows every row instead of categories, which is millions of documents.

I only need category totals to be seen in table.


回答1:


I guess you could use a data table but you might be better off with a repeat control.

Use SSJS Or Java and a Notes View Navigator. That has methods to skip from 1 category to another. So your not looping over each document. As you lop the categories pull out the data. Title and value whatever and add them to a hashmap. Return the hashmap to the repeat control. And use that to get the look similar to what you posted minus the twistie expandability.

If you really do want the twisties, and I hope not, but if you do you can uses a nested repeat control to get that effect.




回答2:


Do not use standard view Data Source, when you need just categories and totals. So get them with view navigator class and feed them into custom structure ([["category", "total"], ["category", "total"]]) and render them with repeat control.

More robust approach would be to use custom data source or managed bean to initialize and hold only category rows.




回答3:


You need a simple JavaScript function that uses a view navigator to pull the category data. While high charts can use a HTML table, you are better off with a json call - less parsing required. Feel free to reuse the function I wrote for exactly that purpose. I used it with d3js but it should be easy to adopt it for high charts.



来源:https://stackoverflow.com/questions/24905962/data-table-to-show-only-category-totals

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!