2013年9月17日星期二

Page refresh , how to checkbox is still selected ?



<table width="95%" border="0" cellpadding="2" cellspacing="1">
       <tr>
        <td><input type="checkbox" id="chk" name="chk" />高级查询</td>
</tr>
              <tr id="tr2">
<td class="textblakright">申请人:</td>
        <td align="left" >
            <input type="text" name="i-0-appUser" id="i-0-appUser"  class="textinputForDC" value="${archive.appUser}"/>
</td>
<td class="textblakright">申请单位:</td>
<td align="left" >
 <select name="i-0-appDapt" id="i-0-appDapt">
               <option value="0">-请选择-</option>
           </select>
        </td>
</tr>
 <tr id="tr3">
<td class="textblakright">一级分类:</td>
        <td align="left" >
           <select id="typeone">
               <option value="0">-请选择-</option>
           </select>
</td>
<td class="textblakright">二级分类:</td>
<td align="left" >
   <input type="hidden" size="10" id="i-0-btId" name="i-0-btId" readonly="readonly" value="" />
   <select id="typeTwo">
     <option value="0">-请选择-</option>
           </select>
        </td>
</tr>
    </table>




when the page loads , tr2 and tr3 hidden by default

elected senior query display

data is obtained via ajax

When clicking on inquiry, in the case of the whole page to refresh how to make checkbox checked and tr2 and tr3 the query condition does not disappear?











------ Solution ------------------------------------ --------
use Cookie to remember , is a more traditional approach.
------ Solution ---------------------------------------- ----
you can put the package into a query object , and then query completed and then taken to the page $ { query value == element values ​​? 'checked':''} almost right ..
- ---- Solution -------------------------------------------- < br> Why do not you check ajax? This is not enough
------ Solution ----------------------------------- ---------
practice a lot , I am more commonly refresh the page before saving them to the session , the page is loaded from the session to read
------ Solution ---- ----------------------------------------
our project approach is to query conditions exist to the list and then saved to the session inside .

each will be used to determine when the session.
------ Solution ---------------------------------------- ----


divided into two parts:
1, INPUT the onclick event , will be selected id ( or other identifier ) , stored in the Cookie ; uncheck deleted from the Cookie ;
2, BODY onload event , get Cookie information , and then Cookie information stored id, the set of INPUT


Another approach is currently the largest sites ( eg : taobao) is more commonly used , is composed of all the information URL parameters ; flip capture events such hyperlinks are generated with parameters URL, and then submit .
------ Solution ---------------------------------------- ----
form is submitted, the checkbox selected value with request to save , and then forwarded back to the original page with js selected. .

If it is used struts1 / 2 tab , then select the function can be achieved , but I am more accustomed to using js. .
------ Solution ---------------------------------------- ----

use js seems bad with it, refresh the page , checkbox not get data from the database . session I used, can achieve ah , the data store to the list , and then save them to the session , the page refreshes and then place the session when the value can be achieved. And 5th floor almost.
------ For reference only -------------------------------------- -


specifically so operate it ?
------ For reference only -------------------------------------- -


query I know how to solve , mainly checkbox in the case of how to refresh the page is still selected ?




------ For reference only ---------------------------------- -----
are generally Cookie.
------ For reference only -------------------------------------- -

data Rewind able to solve this problem, I also do so
------ For reference only ----------------- ----------------------


company this framework have to refresh the entire page ,
------ For reference only ------------------------- --------------



This efficiency Gao Bugao

?
------ For reference only -------------------------------------- -

  
  
This efficiency Gao Bugao   
  
?  
Anyway, I always did. . Unless the page has more than N checkbox. .

没有评论:

发表评论