Dandelion Datatables i18n spring resolver not working -


i have started integrate datatables in spring mvc 4 + hibernate 4 + tiles 3 project.

i want display header various language support.

so started link.

as per page suggests header shows ???key??? message.

i want display id in column header showing ???table.header.id???.

this link says

if key cannot found in bundle, ???key??? message displayed in column header.

but have put following in datatables.properties

i18n.locale.resolver=com.github.dandelion.datatables.extras.spring3.i18n.springlocaleresolver
global.i18n.message.resolver=com.github.dandelion.datatables.extras.spring3.i18n.springmessageresolver

also have put in global_en.properties

table.header.id=id

i copied same file global.properties.. not worked.

my jsp file contains

<datatables:table id="users" ...>    <datatables:column titlekey="table.header.id" property="userid" /> <datatables:table /> 

my resource folder structure

res structure

where should put table.header.id=id??

any required. in advance.

note: using ajax source + server-side processing.

about location of messages

you seem using spring resourcebundlemessagesource global basename. makes sense put translations of header columns in global_*.properties files.

about ???key??? message

it turns out bug introduced in v0.10.0.

waiting next version released, there workaround, working dom sources. here follows steps.

1) instead of using titlekey column attribute, use <spring:message> tag. theorically, exact same thing: lookup resource in configured resource bundle.

begin declaring spring taglib in jsp:

<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> 

2) need update usage of dandelion-datatables taglib. workaround, can use <datatables:columnhead> (docs here) tag insert content in column header.

just use follows:

<datatables:table id="users" ... row="user" >     ...     <datatables:column>          <%-- inside tag appear in header column --%>         <datatables:columnhead>             <spring:message code="table.header.id" /> <== appear in column header         </datatables:columnhead>          <%-- else appear in cells --%>                     <c:out value="${person.id}" /> <== appear in column cells     </datatables:column>     ... <datatables:table /> 

some observations:

  • you need add row table attribute if need access object of collection being iterated on, it's done <c:out> tag of jstl
  • you need remove property column attribute, or content of <datatables:column> tag not evaluated

this lot of work little return - sorry - waiting next version released, @ least works. new issue has been added.

if using ajax source + server-side processing.

make variable first

<spring:message code="table.header.id" var="titleid" />  

and added in

<datatables:column title="${titleid}" property="userid" /> 

also fix available here. kindly upgrade 0.10.1-snapshot version.

(disclaimer required stackoverflow: i'm author of dandelion)


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -