humbletrader / katechaki

lightweight java API for reports
http://reportengine.sourceforge.net
Apache License 2.0
6 stars 2 forks source link

Search with HtmlReportOutput #1

Open tanyona opened 6 years ago

tanyona commented 6 years ago

With HtmlReportOutput, is it possible to have a search box where one can search through e.g. like in the DataTables library - https://datatables.net/

humbletrader commented 6 years ago

Every report output is based on templates (free marker templates, so yes, it is possible to put any html or js there.

tanyona commented 6 years ago

OK. How do I customize this template?

humbletrader commented 6 years ago

Look at the examples with custom freemarker templates. There's a startReport.ftl and and endReport.ftl where you can add your html code. There's an example ( configured with spring ) here. In case you don't use spring you will have to translate the following xml into java ( I would say this is fairly easy).

<bean id="output" class="net.sf.reportengine.out.FreemarkerOutput">
    <property name="filePath" value="./output/customFreemarkerConfigurationReport.txt"/>
    <property name="freemarkerConfig">
        <bean class="org.springframework.ui.freemarker.FreeMarkerConfigurationFactoryBean">
                <property name="templateLoaderPath" value="classpath:/freemarker-templates/"/>
                <property name="defaultEncoding" value="utf-8"/>
                <property name="freemarkerSettings" value="locale=cs_CZ"/>
        </bean>
    </property>
</bean>
tanyona commented 6 years ago

For my use case, not all reports will use the same template, so perhaps a way to pass the template to use e.g. when using the builder, something like .withStartReportTemplate(String templateName).

humbletrader commented 5 years ago

I'll think of a better way to configure the templates.