* Draw the table for the first time, adding all required features * @param {object} settings dataTables settings object * @memberof DataTable#oApi
(settings)
| 4334 | * @memberof DataTable#oApi |
| 4335 | */ |
| 4336 | function _fnInitialise(settings) { |
| 4337 | var i |
| 4338 | var init = settings.oInit |
| 4339 | var deferLoading = settings.deferLoading |
| 4340 | var dataSrc = _fnDataSource(settings) |
| 4341 | |
| 4342 | // Ensure that the table data is fully initialised |
| 4343 | if (!settings.bInitialised) { |
| 4344 | setTimeout(function () { |
| 4345 | _fnInitialise(settings) |
| 4346 | }, 200) |
| 4347 | return |
| 4348 | } |
| 4349 | |
| 4350 | // Build the header / footer for the table |
| 4351 | _fnBuildHead(settings, "header") |
| 4352 | _fnBuildHead(settings, "footer") |
| 4353 | |
| 4354 | // Load the table's state (if needed) and then render around it and draw |
| 4355 | _fnLoadState(settings, init, function () { |
| 4356 | // Then draw the header / footer |
| 4357 | _fnDrawHead(settings, settings.aoHeader) |
| 4358 | _fnDrawHead(settings, settings.aoFooter) |
| 4359 | |
| 4360 | // Cache the paging start point, as the first redraw will reset it |
| 4361 | var iAjaxStart = settings.iInitDisplayStart |
| 4362 | |
| 4363 | // Local data load |
| 4364 | // Check if there is data passing into the constructor |
| 4365 | if (init.aaData) { |
| 4366 | for (i = 0; i < init.aaData.length; i++) { |
| 4367 | _fnAddData(settings, init.aaData[i]) |
| 4368 | } |
| 4369 | } else if (deferLoading || dataSrc == "dom") { |
| 4370 | // Grab the data from the page |
| 4371 | _fnAddTr(settings, $(settings.nTBody).children("tr")) |
| 4372 | } |
| 4373 | |
| 4374 | // Filter not yet applied - copy the display master |
| 4375 | settings.aiDisplay = settings.aiDisplayMaster.slice() |
| 4376 | |
| 4377 | // Enable features |
| 4378 | _fnAddOptionsHtml(settings) |
| 4379 | _fnSortInit(settings) |
| 4380 | |
| 4381 | _colGroup(settings) |
| 4382 | |
| 4383 | /* Okay to show that something is going on now */ |
| 4384 | _fnProcessingDisplay(settings, true) |
| 4385 | |
| 4386 | _fnCallbackFire(settings, null, "preInit", [settings], true) |
| 4387 | |
| 4388 | // If there is default sorting required - let's do it. The sort function |
| 4389 | // will do the drawing for us. Otherwise we draw the table regardless of the |
| 4390 | // Ajax source - this allows the table to look initialised for Ajax sourcing |
| 4391 | // data (show 'loading' message possibly) |
| 4392 | _fnReDraw(settings) |
| 4393 |
no test coverage detected