我正在尝试使用百科全书的蒲公英数据表分页.我正在关注此链接文章.我使用的是0.2.14版本.当我尝试使用时
dt:paginationtype ="four_button"它会抛出异常.
它给了我以下错误
2013-08-07 16:26:59,655 ERROR [org.thymeleaf.TemplateEngine] - <[THYMELEAF][http-bio-8080-exec-9] Exception processing template "department/departmentList":
Could not parse as expression: "four_button"
Run Code Online (Sandbox Code Playgroud) 我希望蒲公英数据表一次显示15行,而不是默认的10行。有人可以告诉我如何做到这一点吗?
这是一些我使用分页控件一次显示10行的代码,以在10行的集合之间滚动:
<datatables:table id="mydata" data="${mydataset}" cdn="true" row="mr" theme="bootstrap2"
cssClass="table table-striped" paginate="true" info="false"
cssStyle="width: 150px;" align="left" dom="frtp">
<datatables:column title="Concept Type" cssStyle="width: 150px;" display="html">
<c:out value="${mr.something}"/>
</datatables:column>
</datatables:table>
Run Code Online (Sandbox Code Playgroud) 尝试使用Thymeleaf和蒲公英对数据表进行分页.根据文档我需要更新一些东西:
web.xml(javaconfig尝试进一步向下)
<!-- Dandelion filter definition and mapping -->
<filter>
<filter-name>dandelionFilter</filter-name>
<filter-class>com.github.dandelion.core.web.DandelionFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>dandelionFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- Dandelion servlet definition and mapping -->
<servlet>
<servlet-name>dandelionServlet</servlet-name>
<servlet-class>com.github.dandelion.core.web.DandelionServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>dandelionServlet</servlet-name>
<url-pattern>/dandelion-assets/*</url-pattern>
</servlet-mapping>
Run Code Online (Sandbox Code Playgroud)
SpringTemplateEngine @Bean(跳过,因为我已经有了Thymeleaf模板引擎)
<bean id="templateEngine" class="org.thymeleaf.spring3.SpringTemplateEngine">
<property name="templateResolver" ref="templateResolver" />
<property name="additionalDialects">
<set>
<bean class="com.github.dandelion.datatables.thymeleaf.dialect.DataTablesDialect" />
</set>
</property>
</bean>
Run Code Online (Sandbox Code Playgroud)
我对Spring的了解仍然非常不稳定,但我必须更换web.xml组件(至少我认为我可以这样做):
public class Initializer extends
AbstractAnnotationConfigDispatcherServletInitializer...
@Override
protected Class<?>[] getServletConfigClasses() {
logger.debug("Entering getServletConfigClasses()");
return new Class<?>[] { ThymeleafConfig.class, WebAppConfig.class, DandelionServlet.class };
}
@Override
protected Filter[] getServletFilters() {
return new Filter[] …Run Code Online (Sandbox Code Playgroud) 我正在使用Thymeleaf的Spring Boot,现在我想添加蒲公英数据表,但它不起作用.
这是我的maven依赖项:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.1.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- Dandelion -->
<dependency>
<groupId>com.github.dandelion</groupId>
<artifactId>datatables-thymeleaf</artifactId>
<version>0.10.1</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
我正在遵循本指南http://dandelion.github.io/dandelion/docs/installation/thymeleaf.html并配置以下bean:
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
@Bean
public FilterRegistrationBean dandelion() {
FilterRegistrationBean registrationBean = new FilterRegistrationBean();
registrationBean.setFilter(new DandelionFilter());
registrationBean.addUrlPatterns("/*"); …Run Code Online (Sandbox Code Playgroud)