I recently finished the play tutorial..In the CRUD Admin area,there is a search facility ,where you can search for a keyword in title of Posts.Where do I find the code for that particular function?(search).I went thru the CRUD module code ,but could not find 开发者_运维问答it.Can someone help?
The search here?
The relevant part of the code is (in CRUD.java [see modules/crud/app/controller
in your play install dir.]):
@SuppressWarnings("unchecked")
public List<Model> findPage(int page, String search, String searchFields,
String orderBy, String order, String where)
{
return Model.Manager.factoryFor(entityClass).fetch((page - 1) * getPageSize(),
getPageSize(), orderBy, order, searchFields == null ?
new ArrayList<String>() : Arrays.asList(searchFields.split("[ ]")),
search, where);
}
精彩评论