|
352 | 352 | if (angular.isDefined(options.fnPromise) && options.fnPromise !== null) {
|
353 | 353 | return new PromiseRenderer(options);
|
354 | 354 | }
|
355 |
| - if (angular.isDefined(options.sAjaxSource) && options.sAjaxSource !== null) { |
| 355 | + if (angular.isDefined(options.sAjaxSource) && options.sAjaxSource !== null || options.ajax !== null) { |
356 | 356 | return new AjaxRenderer(options);
|
357 | 357 | }
|
358 | 358 | return new DefaultRenderer(options);
|
|
484 | 484 | oTable.fnReloadAjax(options.sAjaxSource);
|
485 | 485 | } else if (!_isDTOldVersion(oTable)) {
|
486 | 486 | // For DataTable v1.10+, DT provides methods https://datatables.net/reference/api/ajax.url()
|
487 |
| - oTable.ajax.url(options.sAjaxSource).load(); |
| 487 | + var ajaxUrl = options.sAjaxSource || options.ajax.url || options.ajax; |
| 488 | + oTable.ajax.url(ajaxUrl).load(); |
488 | 489 | } else {
|
489 | 490 | throw new Error('Reload Ajax not supported. Please use the plugin "fnReloadAjax" (https://next.datatables.net/plug-ins/api/fnReloadAjax) or use a more recent version of DataTables (v1.10+)');
|
490 | 491 | }
|
|
505 | 506 | _this.options.aoColumns = DT_DEFAULT_OPTIONS.aoColumns;
|
506 | 507 | }
|
507 | 508 | $scope.$watch('dtOptions.sAjaxSource', function (sAjaxSource) {
|
508 |
| - _this.options.sAjaxSource = sAjaxSource; |
509 |
| - _this.options.ajax = sAjaxSource; |
| 509 | + if (angular.isDefined(sAjaxSource)) { |
| 510 | + _this.options.sAjaxSource = sAjaxSource; |
| 511 | + if (angular.isDefined(_this.options.ajax)) { |
| 512 | + if (angular.isObject(_this.options.ajax)) { |
| 513 | + _this.options.ajax.url = sAjaxSource; |
| 514 | + } else { |
| 515 | + _this.options.ajax = { url: sAjaxSource }; |
| 516 | + } |
| 517 | + } |
| 518 | + } |
510 | 519 | _render(options, $elem, $scope);
|
511 | 520 | });
|
512 | 521 | $scope.$watch('dtOptions.reload', function (reload) {
|
|
0 commit comments