spring-mvcthemesdatatablesjquery-ui-themedandelion

dandelion datatables spring mvc runtime themeoption


I am trying to use jqueryui themes in dandelion datatables. So I started with this link. But, can we pass themeoption at runtime?

<datatables:table id="users" data="${list}" row="user"
     rowIdBase="userId" rowIdPrefix="person_"  pageable="true" displayLength="5"       
     filterable="true"  processing="true" autoWidth="true" 
     theme="jqueryui" 
     themeOption="<spring:theme code="theme"/>" 

or

<datatables:table id="users" data="${list}" row="user"
     rowIdBase="userId" rowIdPrefix="person_"  pageable="true" displayLength="5"       
     filterable="true"  processing="true" autoWidth="true" 
     theme="jqueryui" 
     themeOption="<c:out value="theme"/>" 

I want to use the spring theme. I am using themeResolver and themeChangeInterceptor. Will the theme of datatables change when I will change the theme?

In my theme-default.properties file

css=themes/blue/style.css
theme=start

My theme names are default, green, orange, purple, and red.

datatables's themes I want to use are start, southstreet, humanity, peppergrinder, and flick respectively.

How can I achieve this?


Solution

  • All tag attributes accept Runtime Expression values.

    Maybe you should try the following syntax:

    Example 1:

    <spring:theme code="theme" var="springTheme" />
    <datatables:table id="users" data="${list}" row="user"
         rowIdBase="userId" rowIdPrefix="person_"  pageable="true" displayLength="5"       
         filterable="true"  processing="true" autoWidth="true" 
         theme="jqueryui" 
         themeOption="${springTheme}">
         ...
    </datatables:table>
    

    Example 2:

    <datatables:table id="users" data="${list}" row="user"
         rowIdBase="userId" rowIdPrefix="person_"  pageable="true" displayLength="5"       
         filterable="true"  processing="true" autoWidth="true" 
         theme="jqueryui" 
         themeOption="${theme}">
        ...
    </datatables>
    

    (Disclaimer required by StackOverflow: I'm the author of Dandelion)