2013-03-18 1 views
1

서버 쪽 처리가 활성화 된 dataTable jquery 플러그인을 사용하고 있습니다. fnReloadAjax 기능을 사용하는 동안 처리 div 숨기기와 새 데이터 표시간에 2-3 초의 지연이 있습니다. 이 문제와 관련하여 다음은 post입니다. 이것이 datatable에 의해 만들어진 여러 서버 요청 때문이라는 것을 알게되었습니다. 나는 두 개의 요청이 다른데이터 여러 서버 쪽 요청을 생성하는 테이블

후 1 만들어지고 참조 불을 지르고 콘솔에서

oTable.fnReloadAjax("getCaseList?caseStatus=xxx&showValidOnly=true"); 

을 다음과 같이 라디오 버튼의 집합의 내 페이지 onchange 이벤트에서

새로운 데이터를 서버에 전화를하고있다
  1. GET https://localhost/getCaseList?caseStatus=xxx&showValidOnly=true&_=1363611652185
  2. GET https://localhost/getCaseList?caseStatus=xxx&showValidOnly=true&sEcho=4&iColumns=9&sColumns=&iDisplayStart=0&iDisplayLength=100&sSearch=&bRegex=false&sSearch_0=&bRegex_0=false&bSearchable_0=true&sSearch_1=&bRegex_1=false&bSearchable_1=true&sSearch_2=&bRegex_2=false&bSearchable_2=true&sSearch_3=&bRegex_3=false&bSearchable_3=true&sSearch_4=&bRegex_4=false&bSearchable_4=true&sSearch_5=&bRegex_5=false&bSearchable_5=true&sSearch_6=&bRegex_6=false&bSearchable_6=true&sSearch_7=&bRegex_7=false&bSearchable_7=true&sSearch_8=&bRegex_8=false&bSearchable_8=true&iSortingCols=1&iSortCol_0=4&sSortDir_0=desc&bSortable_0=false&bSortable_1=true&bSortable_2=true&bSortable_3=true&bSortable_4=true&bSortable_5=true&bSortable_6=true&bSortable_7=true&bSortable_8=true&_=1363611701804

첫 번째 요청 완료 후 처리 div가 숨겨 지지만 두 번째 요청이 완료된 후에 만 ​​새 데이터가로드됩니다.

두 번째 추가 호출을 데이터 테이블로 만드는 이유는 무엇입니까?

답변

1

동일한 문제가 발생했습니다. 내 경우에는 또한 내가 서버 측 처리를 사용하고 있습니다. DataTable의 초기화 된 후, 나는 일부 열

tableExample.fnSetColumnVis(5, false); 
tableExample.fnSetColumnVis(6, false); 
tableExample.fnSetColumnVis(3, false); 

을 숨기려면 아래 문을 작성했다 그리고 나는 4 번을 요청했다 깨달았다. 그런 다음이 줄을 제거하고 여러 요청 문제가 해결되었습니다. 열을 숨기려면 어떻게해야할까요? datatable의 열 정의에있는 열에 "display : none"을 설정하는 클래스 ('sClass': 'hidden')를 추가하는 방법이 있습니다.

aoColumnDefs: [ 
     { "bSortable": true, "aTargets": [0] }, 
     { "bSortable": true, "aTargets": [1] }, 
     { "bSortable": false, "aTargets": [2] }, 
     { "bSortable": true, "aTargets": [3] }, 
     { "bSortable": true, "aTargets": [4] }, 
     { "bSortable": true, "aTargets": [5], "sClass": "hidden" }, 
     { "bSortable": true, "aTargets": [6], "sClass": "hidden" }, 
     { "bSortable": false, "aTargets": [7] }, 
     { "bSortable": false, "aTargets": [8] }, 
     { "bSortable": false, "aTargets": [9], "sClass": "hidden" }   

     ] 

희망이 있습니다. 감사합니다

0

서버 쪽 요청은 _fnDraw에서 호출되는 내부 _fnAjaxUpdate 함수에 의해 발급됩니다.

즉, 테이블을 다시 정렬하거나 검색하는 것과 같이 추가 요청을 발행해야하는 메소드가 필요합니다.

관련 문제