Hello,
> Is it possible to set search option in Display Table. Ie in the text box if
> I enter some text and enter only the matching string content should be
> displayed with out refreshing the page. Like data table of jQuery. I cant
> use data table as this will load all the records at a time. There are
> thousands of records to be displayed which will deteriorate my application
> performance.
If you use sort=external, in your action class, you can set default
search criteria.
For example, Action1.java
Hashtable hash_params = new Hashtable();
hash_params.put("search_criteria1", search_string_constraint);
SqlSession sql_session = sqlSessionFactory.openSession(false);
TotalRecNum = sql_session.selectOne("query_total", hash_params);
String pageIndexName = new
org.displaytag.util.ParamEncoder(GlobalInfo.ROW_NAME).encodeParameterName(org.displaytag.tags.TableTagParameters.PARAMETER_PAGE);
int pageIndex =
Utils.isNullOrBlank(req.getParameter(pageIndexName))?0:(Integer.parseInt(req.getParameter(pageIndexName))
- 1);
bean_display.setPageIndexName(pageIndexName);
bean_display.setPageIndex(pageIndex);
String sort_index = req.getParameter((new
ParamEncoder(GlobalInfo.ROW_NAME)).encodeParameterName(TableTagParameters.PARAMETER_SORT));
ParamEncoder pe = new ParamEncoder(GlobalInfo.ROW_NAME);
String sortColParam =
pe.encodeParameterName(TableTagParameters.PARAMETER_SORT);
String sort_col_name = req.getParameter(sortColParam);
String sort_code = req.getParameter(new
ParamEncoder(GlobalInfo.ROW_NAME).encodeParameterName(TableTagParameters.PARAMETER_ORDER));
String sort_desc = null;
/** Descending is 2, Ascending is 1. */
if(!Utils.isNullOrBlank(sort_code))
{
if(sort_code.equals("1"))
{
sort_desc = " ASC ";
}
else if(sort_code.equals("2"))
{
sort_desc = " DESC ";
}
}
if(!Utils.isNullOrBlank(sort_col_name) &&
!Utils.isNullOrBlank(sort_desc))
{
bean_display.setSortInfo(sort_col_name + " " + sort_desc);
hash_params.put("sortInfo", bean_display.getSortInfo());
}
hash_params.put(GlobalInfo.PAGE_SIZE,
bean_display.getPageSize());
hash_params.put(GlobalInfo.OFFSET,
bean_display.getOffset());
Object obj = sql_session.selectList("get_result_list", hash_params);
if(!Utils.isNull(obj))
{
alist_paging_bean = (ArrayList<BeanDisplayTagStaff>)obj;
}
req.setAttribute("alist_paging_bean", this.alist_paging_bean);
Hope this helps,
Emi
--
<display:table
id="<%=ROW_NAME %>"
name="alist"
export="true"
class="simple"
cellspacing="0"
cellpadding="5"
requestURI="Action1"
keepStatus="false"
pagesize="<%=PageSize %>"
partialList="true"
size="<%=TotalRecNum %>"
sort="external"
>
------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts.
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
_______________________________________________
displaytag-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/displaytag-user