JS lib:Datatables。分页在服务器端调用中不起作用

时间:2016-05-26 22:40:42

标签: javascript datatables

在深入研究Datatables源代码之前,这是在黑暗中完全拍摄的。

所以,我已经实现了一个JSON服务来支持Datatables。问题是,我可以比实际数据更进一步分页。

我唯一能找到的可能影响分页的主题是在json中返回recordTotal: https://datatables.net/manual/server-side#Returned-data

我的所有服务都返回了准确的记录计数,但我仍然可以在有实际数据的地方分页。偶然的任何人都碰巧知道发生了什么?对于记录,JSON响应是有效的:



{
  "recordsTotal": 8023,
  "data": [
    [
      8001,
      "W078292",
      "SHARPCUT REGRIND DIV",
      "",
      "",
      "Non-Core",
      2,
      "$               15.00"
    ],
    [
      8002,
      "W5041016",
      "RPR: MILWAUK  2602-2",
      "",
      "",
      "Non-Core",
      1,
      "$              164.80"
    ],
    [
      8003,
      "W5042707",
      "RPR: HARRINGT ??",
      "",
      "",
      "Non-Core",
      1,
      "$              249.65"
    ],
    [
      8004,
      "W5043247",
      "RPR: FASCO    11081F",
      "",
      "",
      "Non-Core",
      1,
      "$               80.42"
    ],
    [
      8005,
      "W5043921",
      "CALIBRATION",
      "",
      "",
      "Non-Core",
      1,
      "$               62.51"
    ],
    [
      8006,
      "W5044744",
      "RPR: DEWALT   DC900",
      "",
      "",
      "Non-Core",
      1,
      "$               16.00"
    ],
    [
      8007,
      "W5044758",
      "RPR: DEWALT   DC305",
      "",
      "",
      "Non-Core",
      1,
      "$              141.38"
    ],
    [
      8008,
      "W5044760",
      "RPR: MILWAUKE 6517-2",
      "",
      "",
      "Non-Core",
      1,
      "$               72.50"
    ],
    [
      8009,
      "W5045318",
      "RPR: MILWAUKE 2652-2",
      "",
      "",
      "Non-Core",
      1,
      "$               95.65"
    ],
    [
      8010,
      "W5047329",
      "RPR: METABO   WP8-11",
      "",
      "",
      "Non-Core",
      1,
      "$               44.70"
    ],
    [
      8011,
      "W5049657",
      "RPR: IR       259",
      "",
      "",
      "Non-Core",
      2,
      "$              620.48"
    ],
    [
      8012,
      "W5049658",
      "RPR: IR       2145QI",
      "",
      "",
      "Non-Core",
      2,
      "$              539.44"
    ],
    [
      8013,
      "W5049659",
      "RPR: IR       2145QI",
      "",
      "",
      "Non-Core",
      2,
      "$              539.44"
    ],
    [
      8014,
      "W5050385",
      "RPR: DEWALT   DWE402",
      "",
      "",
      "Non-Core",
      1,
      "$               49.99"
    ],
    [
      8015,
      "W5050386",
      "RPR: DEWALT   DWE402",
      "",
      "",
      "Non-Core",
      1,
      "$               49.99"
    ],
    [
      8016,
      "W5051607",
      "CARGILL INSPECTION",
      "",
      "",
      "Non-Core",
      1,
      "$            5,000.00"
    ],
    [
      8017,
      "W5053076",
      "RPR: DEWALT   ?",
      "",
      "",
      "Non-Core",
      1,
      "$               25.00"
    ],
    [
      8018,
      "WE6340000A20000",
      "M4  EXT TOOTH L\/W A2",
      "01-Fasteners",
      "05-Washers",
      "Non-Core",
      800,
      "$               11.12"
    ],
    [
      8019,
      "XM2540008A20000",
      "M5 X 8 PH FHMS A-2",
      "01-Fasteners",
      "03-Screws",
      "Non-Core",
      150,
      "$                5.00"
    ],
    [
      8020,
      "XM2540020A20000",
      "M5 X 20 PH FHMS A-2",
      "01-Fasteners",
      "03-Screws",
      "Core",
      50,
      "$                2.00"
    ],
    [
      8021,
      "XM2540025A20000",
      "M5 X 25 PH FHMS A-2",
      "01-Fasteners",
      "03-Screws",
      "Core",
      50,
      "$                3.00"
    ],
    [
      8022,
      "XM2540030A20000",
      "M5 X 30 PH FHMS A-2",
      "01-Fasteners",
      "03-Screws",
      "Core",
      50,
      "$                5.00"
    ],
    [
      8023,
      "XM2550016A20000",
      "M6 X 16 PH FHMS A-2",
      "01-Fasteners",
      "03-Screws",
      "Core",
      50,
      "$                3.10"
    ]
  ]
}




0 个答案:

没有答案