how to display data table items in the reverse order in order of id ...
back language i'am using scala
reverse order data in the data table or models,and display on in view the page using,
play framework or Normal html
在查看页面...
@helper.form(action = routes.Application.listAllpost) {
<fieldset>
@for(post<- posts){
<h3>
@post.name </h3><br/><br/>
</fieldset>
}
并在列出帖子的应用程序页面中
val pos:Post=null
val postNotifiaction:PostNotification=null
def listAllpost()= Action{
val post:List[Post]=Post.listAllPostById
Ok(views.html.allPosts.render(Application.postNotificationForm,post,pos,postNotifiaction))
}
def listPsts = Action { implicit request =>
val today = Calendar.getInstance().getTime()
val alert: Alert = new Alert("", "")
Common.setAlert(alert)
createPostForm.bindFromRequest.fold(
errors => BadRequest(views.html.createPost(errors, "There is some error","")),
post => {
Post.findByPostName(post.name).isEmpty match {
case true => case false =>
}
Results.Redirect("/post")
})
}
在这里,我在重新加载最后一个页面时在 db 中添加一个post..
所以我希望最后一篇文章在顶部..有任何方法..任何人都知道方法..请在此处提及....