2017-12-06 15 views
0
내가 브라우저에서

부트 스트랩 - 테이블 가져 오기 저장된 쿠키

내 요구 사항은 내가이 저장된 쿠키를 얻을 필요가있다 저장 상태를 가능하게하는 부트 스트랩 - 테이블 cookie.js을 사용했다 을 표 데이터를 표시하는 부트 스트랩 - 테이블을 사용하고

(상태)를 SQL 서버에 저장하고 다음에 사용자가 저장된 상태로 로그인해야합니다.

내가 링크 BS-Cookie 시도 대해 getCookies 방법을 따랐다하지만 항상 null를

내 코드를 반환

<script src="~/assets/bootstrap-table/src/bootstrap-table.js"></script> 
<script src="~/assets/bootstrap-table/src/extensions/export/bootstrap-table-export.js"></script> 
<script src="~/assets/bootstrap-cookie/bootstrap-table-cookie.js"></script> 


<div> 
    <button id="btnSaveState"> save </button> 
</div> 
<table id="tblff"> 
    <thead> 
     <tr> 
      <th data-field="RID" rowspan="2" class="hdr" 
       data-cell-style="OperateFormatter">REQID</th>   
      <th data-field="DTP" rowspan="2"> DT OPENED</th> 
      <th data-field="SUM" rowspan="2"> SUMM</th> 
     </tr>  
    </thead> 
</table> 
<script type="text/javascript"> 
    $(function() { 
     $.ajax({ 
      url: initalURL 
       , type: 'GET' 
       , contentType: "application/json; charset=utf-8" 
       , dataType: "json" 
       , success: function (response) { 
        $('#CRFTable').bootstrapTable({ 
         data: response.rows 
          , cookie: true 
          , cookieIdTable: userID 
          , showRefresh: true 
          , showToggle: true 
          , showColumns: true 
         , showExport: true 
         , exportTypes: "['excel']" 
         , pagination: true 
         , pageList: "[10, 25, 50, 100, ALL]" 
         , idField: "RID" 
         , toolbar: $("#custToolbar") 
        }); 
       } 
       , failure: function (response) { 
        alert(response.responseText); 
       } 
       , error: function (response) { 
        alert(response.responseText); 
       } 
     }); 

     $("#btnSaveState").on('click', function() { 
      try { 
       var cookieDetails = $('#tblff').bootstrapTable().getCookie(); 
       alert(cookieDetails); 
      } catch (e) { 

      } 
     }) 
    }); 
</script> 

그러나 대해 getCookies의 결과는 항상 null입니다.

누군가가 당신처럼 사용한다

답변

0

부트 스트랩 테이블에 의해 저장된 쿠키 값을 얻을 수있는 좋은 예를 제공 할 수 있습니다. $ ("# 테이블") bootstrapTable를 ('대해 getCookies')