2017-11-01 8 views
0

나는 datatables를 사용하고있는 symfony 3를 사용하여 응용 프로그램을 개발 중입니다.데이터 테이블의 전체 행 수를 변경하는 방법

데이터베이스의 모든 행을 가져 오지 않으려면 im은 doctrine의 paginator를 사용하십시오. 그래서 datatable 먼저 100 요소를 얻을 것이다 다음 다음 단추를 클릭하면 다음 100 요소를 청구합니다.

내 문제는 처음 100 개의 요소로 datatable을 설정할 때 다음 버튼을 클릭한다는 것입니다. (100 개의 요소를 보여주기 때문에 다른 요소는 없습니다). 나는 100 개 이상의 요소를 가지고 있다고 말하고 싶다. 그래서 어떻게해야합니까?

내 테이블 : 내가 찾은

<table class="table table-striped table-bordered dt-responsive nowrap" cellspacing="0" width="100%" 
        id="table_city"> 
       <thead> 
       <tr> 
        <th>Code</th> 
        <th>Name</th> 
        <th>Region</th> 
        <th>Country</th> 
        <th class="no-sort">Actions</th> 
       </tr> 
       </thead> 
       <tbody> 
       {% for core_city in core_cities %} 
        <tr> 
         <td>{{ core_city.code }}</td> 
         <td>{{ core_city }}</td> 
         <td>{{ core_city.CoreRegion }}</td> 
         <td>{{ core_city.CoreRegion.coreCountry }}</td> 
         <td class="datatable_td_buttons"> 
          <a class="m-portlet__nav-link btn m-btn m-btn--icon m-btn--icon-only m-btn--pill" 
           title="Show" href="{{ path('core_city_show', { 'id': core_city.id }) }}"> 
           <i class="la la-search"></i> 
          </a> 
          <a href="{{ path('core_city_edit', { 'id': core_city.id }) }}" 
           class="m-portlet__nav-link btn m-btn--icon m-btn--icon-only m-btn--pill" title="Edit"> 
           <i class="la la-edit"></i> 
          </a> 
          <a href="{{ path('core_zip_code_import_by_city', { 'id': core_city.id }) }}" 
           class="m-portlet__nav-link btn m-btn--icon m-btn--icon-only m-btn--pill" 
           title="Import Zip Code"> 
           <i class="la la-upload"></i> 
          </a> 
         </td> 
        </tr> 
       {% endfor %} 
       </tbody> 
      </table> 
+1

, 그것은 이것에 대한 심포니 번들 여기가 보인다 -> **은 https ://github.com/webinarium/DataTablesBundle** – davidkonrad

+0

감사합니다. :) – Ld91

답변

0

솔루션 :

$('#example').dataTable({ 
    "infoCallback": function(settings, start, end, max, total, pre) { 
    return start +" to "+ end; 
    } 
}); 
당신은 서버 측 처리를 사용해야합니다