|
1 | 1 | /* |
2 | 2 | * File: jquery.dataTables.columnFilter.js |
3 | | -* Version: 1.5.3. |
| 3 | +* Version: 1.5.4. |
4 | 4 | * Author: Jovan Popovic |
5 | 5 | * |
6 | 6 | * Copyright 2011-2014 Jovan Popovic, all rights reserved. |
|
385 | 385 |
|
386 | 386 | function fnCreateSelect(oTable, aData, bRegex, oSelected) { |
387 | 387 | var oSettings = oTable.fnSettings(); |
388 | | - if (aData == null && oSettings.sAjaxSource != "" && !oSettings.oFeatures.bServerSide) { |
| 388 | + if ( (aData == null || typeof(aData) == 'function' ) && oSettings.sAjaxSource != "" && !oSettings.oFeatures.bServerSide) { |
389 | 389 | // Add a function to the draw callback, which will check for the Ajax data having |
390 | 390 | // been loaded. Use a closure for the individual column elements that are used to |
391 | 391 | // built the column filter, since 'i' and 'th' (etc) are locally "global". |
392 | 392 | oSettings.aoDrawCallback.push({ |
393 | 393 | "fn": (function (iColumn, nTh, sLabel) { |
394 | | - return function () { |
| 394 | + return function (oSettings) { |
395 | 395 | // Only rebuild the select on the second draw - i.e. when the Ajax |
396 | 396 | // data has been loaded. |
397 | 397 | if (oSettings.iDraw == 2 && oSettings.sAjaxSource != null && oSettings.sAjaxSource != "" && !oSettings.oFeatures.bServerSide) { |
398 | | - return fnCreateColumnSelect(oTable, null, _fnColumnIndex(iColumn), nTh, sLabel, bRegex, oSelected); //Issue 37 |
| 398 | + return fnCreateColumnSelect(oTable, aData && aData(oSettings.aoData, oSettings), _fnColumnIndex(iColumn), nTh, sLabel, bRegex, oSelected); //Issue 37 |
399 | 399 | } |
400 | 400 | }; |
401 | 401 | })(i, th, label), |
402 | 402 | "sName": "column_filter_" + i |
403 | 403 | }); |
404 | 404 | } |
405 | 405 | // Regardless of the Ajax state, build the select on first pass |
406 | | - fnCreateColumnSelect(oTable, aData, _fnColumnIndex(i), th, label, bRegex, oSelected); //Issue 37 |
| 406 | + fnCreateColumnSelect(oTable, typeof(aData) == 'function' ? null: aData, _fnColumnIndex(i), th, label, bRegex, oSelected); //Issue 37 |
407 | 407 |
|
408 | 408 | } |
409 | 409 |
|
|
0 commit comments