struts-community-plugins / struts2-jquery

Struts2 jQuery Plugin
Apache License 2.0
83 stars 49 forks source link

Datatable configuration does not work #335

Closed nikosdimitrakas closed 1 year ago

nikosdimitrakas commented 1 year ago

Since upgrading from 4.x to 5.x, specifying configurations like searching="false" info="false" paging="false" and autoWidth="false" don't have any effect. We have tried 5.0.1 and 5.0.2 and also the unreleased changes to datatables-close.ftl The class DatatablesTag has not changed since 2018, so where is this change in behaviour coming from? It seems that the javascript that is generated immediately after the closing tag for the table is not including all the flags. theme, jqueryaction, id, order and others are included, but not autoWidth, info, paging and searching. It worked fine until version 4.1.0-SNAPSHOT It seems that the changes from 2022-10-17 may have caused this. Only the parameters that are booleans seem to have stopped working.

nikosdimitrakas commented 1 year ago

This probably relates to the bug described at https://freemarker.apache.org/docs/dgui_template_exp.html#dgui_template_exp_missing_default

?default(v) has been replaced by !v but the expressions should be inside parentheses to avoid evaluation of == before !

For example <#if parameters.autoWidth!true == false> should be <#if (parameters.autoWidth!true) == false> or back to the deprecated version <#if parameters.autoWidth?default(true) == false>

lukaszlenart commented 1 year ago

Thanks @nikosdimitrakas for pointing this out, could you review the attached PR?

nikosdimitrakas commented 1 year ago

I tested your changes and they fix the issue.

lalumastan commented 1 year ago

@lukaszlenart Appreciate your prompt response. When can we expect the 5.0.3 release?

lukaszlenart commented 1 year ago

Hopefully soon :) There is on issue with jqgrid I would like to investigate and maybe address in 5.0.3