can we set search option in display tag

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

can we set search option in display tag

Raaja G
Hi,

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.

--regards,
raaja.g
luy
Reply | Threaded
Open this post in threaded view
|

Re: can we set search option in display tag

luy
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&reg; 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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/displaytag-user
Reply | Threaded
Open this post in threaded view
|

Re: can we set search option in display tag

CRANFORD, CHRIS
In reply to this post by Raaja G
I'd likely say that this is considered out-of-scope of what the library
is meant to do.

All you need to do is to create a form that allows the user to enter
their search criteria and submit it along with any other relevant pieces
of data for the search.  Your servlet call would then search the results
accordingly and return the results which are hits based on the criteria
and would only retrieve a page of records at a time.  This would not
impact your performance and would solve your problem.

If you want to use something that looks clean and robust without
redrawing the screen on each search, you can also hook in AJAX so that
you fire the search & paging back to the server in an AJAX call and
re-render a DIV with the AJAX results.  

Chris

-----Original Message-----
From: Raaja G [mailto:[hidden email]]
Sent: Thursday, August 04, 2011 6:53 AM
To: [hidden email]
Subject: [displaytag-user] can we set search option in display tag


Hi,

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.

--regards,
raaja.g
--
View this message in context:
http://old.nabble.com/can-we-set-search-option-in-display-tag-tp32193707
p32193707.html
Sent from the DisplayTag - General mailing list archive at Nabble.com.


------------------------------------------------------------------------
------
BlackBerry&reg; 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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/displaytag-user



------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system,
user administration capabilities and model configuration. Take
the hassle out of deploying and managing Subversion and the
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
_______________________________________________
displaytag-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/displaytag-user