MCPcopy Create free account
hub / github.com/breck7/scroll / _fnAjaxUpdateDraw

Function _fnAjaxUpdateDraw

external/.datatables.js:3956–3988  ·  view source on GitHub ↗

* Data the data from the server (nuking the old) and redraw the table * @param {object} oSettings dataTables settings object * @param {object} json json data return from the server. * @param {string} json.sEcho Tracking flag for DataTables to match requests * @param {int} json.iTotalReco

(settings, json)

Source from the content-addressed store, hash-verified

3954 * @memberof DataTable#oApi
3955 */
3956 function _fnAjaxUpdateDraw(settings, json) {
3957 var data = _fnAjaxDataSrc(settings, json)
3958 var draw = _fnAjaxDataSrcParam(settings, "draw", json)
3959 var recordsTotal = _fnAjaxDataSrcParam(settings, "recordsTotal", json)
3960 var recordsFiltered = _fnAjaxDataSrcParam(settings, "recordsFiltered", json)
3961
3962 if (draw !== undefined) {
3963 // Protect against out of sequence returns
3964 if (draw * 1 < settings.iDraw) {
3965 return
3966 }
3967 settings.iDraw = draw * 1
3968 }
3969
3970 // No data in returned object, so rather than an array, we show an empty table
3971 if (!data) {
3972 data = []
3973 }
3974
3975 _fnClearTable(settings)
3976 settings._iRecordsTotal = parseInt(recordsTotal, 10)
3977 settings._iRecordsDisplay = parseInt(recordsFiltered, 10)
3978
3979 for (var i = 0, ien = data.length; i < ien; i++) {
3980 _fnAddData(settings, data[i])
3981 }
3982 settings.aiDisplay = settings.aiDisplayMaster.slice()
3983
3984 _fnColumnTypes(settings)
3985 _fnDraw(settings, true)
3986 _fnInitComplete(settings)
3987 _fnProcessingDisplay(settings, false)
3988 }
3989
3990 /**
3991 * Get the data from the JSON data source to use for drawing a table. Using

Callers 1

_fnAjaxUpdateFunction · 0.85

Calls 9

_fnAjaxDataSrcFunction · 0.85
_fnAjaxDataSrcParamFunction · 0.85
_fnClearTableFunction · 0.85
_fnAddDataFunction · 0.85
_fnColumnTypesFunction · 0.85
_fnDrawFunction · 0.85
_fnInitCompleteFunction · 0.85
_fnProcessingDisplayFunction · 0.85
sliceMethod · 0.80

Tested by

no test coverage detected