jimgardener
jimgardener

Reputation: 637

code for search in CRUD area in playframework

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?

Upvotes: 2

Views: 388

Answers (1)

user180100
user180100

Reputation:

The search here? CRUD admin area

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);
}

Upvotes: 2

Related Questions