dataTable - 페이징 안되는 문제(계속 1page로 뜸)

boingboing·2022년 3월 21일
0

현상

dataTable - 페이징 안되는 문제(계속 1page로 뜸)

문제의 코드

  • 각 페이지마다 필터링된 데이터 = sample_list_per_page
  • 전체 데이터 = sample_list_all
datalist_to_json = json.dumps(
            {"data": sample_list_data, "recordsFiltered": len(sample_list_data), "recordsTotal": len(sample_list)}
        ) # python 데이터 -> json

원인

  • Total records, after filtering
    (i.e. the total number of records after filtering has been applied
  • not just the number of records being returned for this page of data).
  • recordsFiltered에 해당 페이지의 갯수만 넣는 줄 알았는데, 그게 아니라 전체 데이터 갯수를 넣어야 함.....

해결

datalist_to_json = json.dumps(
            {"data": sample_list_data, "recordsFiltered": len(sample_list), "recordsTotal": len(sample_list)}
        ) # python 데이터 -> json

0개의 댓글