开发者

Dynamic sorting of tables on BIRT without javascript

I am using WebViewerExample as my reporting.

I am designing reports within Eclipse using report designer.

I have a table with several columns. Data is retrieved from database.

Is there an easy way to dynamically sort the tables by clicking on the column header names?

I tried to pass string as a sorting cond开发者_开发百科ition, but it ain't helping.

Any ideas?


Have you tried adding an ORDER BY to the query and ten parameterizing it? You may need to do some REALLY lightweight scripting in order to massage the underlying query at run-time. All that we are talking about is doing a string replace on the sort condition in the query.

Original Query:

SELECT Col1, Col2, Col3, Col4
FROM Table1
WHERE Something = Something
ORDER Col1 ASC

The beforeOpen Event on the Data Set:

this.queryText = this.queryText.replace("Col1", "Your new Sort Spec");

That will do the trick. Good Luck!


There is an easier way, if you have a default.

First set up a paramater, as the sort criteria, in my case, I called it 'sort'. Then select the table, go to the sorting tab, and use the folowing expression: row[params["sort"].value].

This will sort the table by the parameter you pass in. You will need to make sure though that the column names are correct.


do sort or filter parameter in report could'nt be a solution

  • birt iserver with interactive web viewer do sort
  • i try to do less but chipest (just open)

so change the viewer to do the job and not the report

http://dev.sonid.fr/BirtViewer/ ( put your mouse on column header )

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜