3523 var tables = $('.datatable', element); |
3557 var tables = $('.datatable', element); |
3524 if (tables.length > 0) { |
3558 if (tables.length > 0) { |
3525 ams.ajax.check($.fn.dataTable, |
3559 ams.ajax.check($.fn.dataTable, |
3526 ams.baseURL + 'ext/jquery-dataTables-1.9.4' + ams.devext + '.js', |
3560 ams.baseURL + 'ext/jquery-dataTables-1.9.4' + ams.devext + '.js', |
3527 function(first_load) { |
3561 function(first_load) { |
3528 $(tables).each(function() { |
3562 ams.ajax.check($.fn.dataTableExt.oPagination.bootstrap_full, |
3529 ams.ajax.check($.fn.dataTableExt.oPagination.bootstrap_full, |
3563 ams.baseURL + 'myams-dataTables' + ams.devext + '.js', |
3530 ams.baseURL + 'myams-dataTables' + ams.devext + '.js'); |
3564 function() { |
3531 var table = $(this); |
3565 $(tables).each(function () { |
3532 var data = table.data(); |
3566 var table = $(this); |
3533 var extensions = (data.amsDatatableExtensions || '').split(/\s+/); |
3567 var data = table.data(); |
3534 // Check DOM elements |
3568 var extensions = (data.amsDatatableExtensions || '').split(/\s+/); |
3535 var sDom = data.amsDatatableSdom || |
3569 // Check DOM elements |
3536 "W" + |
3570 var sDom = data.amsDatatableSdom || |
3537 ((extensions.indexOf('colreorder') >= 0 || |
3571 "W" + |
3538 extensions.indexOf('colreorderwithresize') >= 0) ? 'R' : '') + |
3572 ((extensions.indexOf('colreorder') >= 0 || |
3539 "<'dt-top-row'" + |
3573 extensions.indexOf('colreorderwithresize') >= 0) ? 'R' : '') + |
3540 (extensions.indexOf('colvis') >= 0 ? 'C' : '') + |
3574 "<'dt-top-row'" + |
3541 ((data.amsDatatablePagination === false || |
3575 (extensions.indexOf('colvis') >= 0 ? 'C' : '') + |
3542 data.amsDatatablePaginationSize === false) ? '' : 'L') + |
3576 ((data.amsDatatablePagination === false || |
3543 (data.amsDatatableGlobalFilter === false ? '' : 'F') + |
3577 data.amsDatatablePaginationSize === false) ? '' : 'L') + |
3544 ">r<'dt-wrapper't" + |
3578 (data.amsDatatableGlobalFilter === false ? '' : 'F') + |
3545 (extensions.indexOf('scroller') >= 0 ? 'S' : '') + |
3579 ">r<'dt-wrapper't" + |
3546 "><'dt-row dt-bottom-row'<'row'<'col-sm-6'" + |
3580 (extensions.indexOf('scroller') >= 0 ? 'S' : '') + |
3547 (data.amsDatatableInformation === false ? '': 'i') + |
3581 "><'dt-row dt-bottom-row'<'row'<'col-sm-6'" + |
3548 "><'col-sm-6 text-right'p>>"; |
3582 (data.amsDatatableInformation === false ? '' : 'i') + |
3549 |
3583 "><'col-sm-6 text-right'p>>"; |
3550 var index; |
3584 |
3551 // Check initial sorting |
3585 var index; |
3552 var sorting = data.amsDatatableSorting; |
3586 // Check initial sorting |
3553 if (typeof(sorting) === 'string') { |
3587 var sorting = data.amsDatatableSorting; |
3554 var sortings = sorting.split(';'); |
3588 if (typeof(sorting) === 'string') { |
3555 sorting = []; |
3589 var sortings = sorting.split(';'); |
3556 for (index=0; index < sortings.length; index++) { |
3590 sorting = []; |
3557 var colSorting = sortings[index].split(','); |
3591 for (index = 0; index < sortings.length; index++) { |
3558 colSorting[0] = parseInt(colSorting[0]); |
3592 var colSorting = sortings[index].split(','); |
3559 sorting.push(colSorting); |
3593 colSorting[0] = parseInt(colSorting[0]); |
3560 } |
3594 sorting.push(colSorting); |
3561 } |
3595 } |
3562 // Check columns sortings |
3596 } |
3563 var columns = []; |
3597 // Check columns sortings |
3564 var column; |
3598 var columns = []; |
3565 var sortables = $('th', table).listattr('data-ams-datatable-sortable'); |
3599 var column; |
3566 for (index=0; index < sortables.length; index++) { |
3600 var sortables = $('th', table).listattr('data-ams-datatable-sortable'); |
3567 var sortable = sortables[index]; |
3601 for (index = 0; index < sortables.length; index++) { |
3568 if (sortable !== undefined) { |
3602 var sortable = sortables[index]; |
3569 column = columns[index] || {}; |
3603 if (sortable !== undefined) { |
3570 column.bSortable = sortable; |
3604 column = columns[index] || {}; |
3571 columns[index] = column; |
3605 column.bSortable = sortable; |
3572 } |
3606 columns[index] = column; |
3573 } |
3607 } |
3574 // Check columns types |
3608 } |
3575 var sortTypes = $('th', table).listattr('data-ams-datatable-stype'); |
3609 // Check columns types |
3576 for (index=0; index < sortTypes.length; index++) { |
3610 var sortTypes = $('th', table).listattr('data-ams-datatable-stype'); |
3577 var sortType = sortTypes[index]; |
3611 for (index = 0; index < sortTypes.length; index++) { |
3578 if (sortType) { |
3612 var sortType = sortTypes[index]; |
3579 column = columns[index] || {}; |
3613 if (sortType) { |
3580 column.sType = sortType; |
3614 column = columns[index] || {}; |
3581 columns[index] = column; |
3615 column.sType = sortType; |
3582 } |
3616 columns[index] = column; |
3583 } |
3617 } |
3584 // Set options |
3618 } |
|
3619 // Set options |
|
3620 var dataOptions = { |
|
3621 bJQueryUI: false, |
|
3622 bFilter: data.amsDatatableGlobalFilter !== false || extensions.indexOf('columnfilter') >= 0, |
|
3623 bPaginate: data.amsDatatablePagination !== false, |
|
3624 bInfo: data.amsDatatableInfo !== false, |
|
3625 bSort: data.amsDatatableSort !== false, |
|
3626 aaSorting: sorting, |
|
3627 aoColumns: columns.length > 0 ? columns : undefined, |
|
3628 bDeferRender: true, |
|
3629 bAutoWidth: false, |
|
3630 iDisplayLength: data.amsDatatableDisplayLength || 25, |
|
3631 sPaginationType: data.amsDatatablePaginationType || 'bootstrap_full', |
|
3632 sDom: sDom, |
|
3633 oLanguage: ams.plugins.i18n.datatables, |
|
3634 fnInitComplete: function (oSettings, json) { |
|
3635 $('.ColVis_Button').addClass('btn btn-default btn-sm') |
|
3636 .html((ams.plugins.i18n.datatables.sColumns || "Columns") + |
|
3637 ' <i class="fa fa-fw fa-caret-down"></i>'); |
|
3638 } |
|
3639 }; |
|
3640 var settings = $.extend({}, dataOptions, data.amsDatatableOptions); |
|
3641 var checkers = []; |
|
3642 var sources = []; |
|
3643 var callbacks = []; |
|
3644 if (extensions.length > 0) { |
|
3645 for (index = 0; index < extensions.length; index++) { |
|
3646 switch (extensions[index]) { |
|
3647 case 'autofill': |
|
3648 checkers.push($.fn.dataTable.AutoFill); |
|
3649 sources.push(ams.baseURL + 'ext/jquery-dataTables-autoFill' + ams.devext + '.js'); |
|
3650 break; |
|
3651 case 'columnfilter': |
|
3652 checkers.push($.fn.columnFilter); |
|
3653 sources.push(ams.baseURL + 'ext/jquery-dataTables-columnFilter' + ams.devext + '.js'); |
|
3654 break; |
|
3655 case 'colreorder': |
|
3656 checkers.push($.fn.dataTable.ColReorder); |
|
3657 sources.push(ams.baseURL + 'ext/jquery-dataTables-colReorder' + ams.devext + '.js'); |
|
3658 break; |
|
3659 case 'colreorderwithresize': |
|
3660 checkers.push(window.ColReorder); |
|
3661 sources.push(ams.baseURL + 'ext/jquery-dataTables-colReorderWithResize' + ams.devext + '.js'); |
|
3662 break; |
|
3663 case 'colvis': |
|
3664 checkers.push($.fn.dataTable.ColVis); |
|
3665 sources.push(ams.baseURL + 'ext/jquery-dataTables-colVis' + ams.devext + '.js'); |
|
3666 callbacks.push(function () { |
|
3667 var cvDefault = { |
|
3668 activate: 'click', |
|
3669 sAlign: 'right' |
|
3670 }; |
|
3671 settings.oColVis = $.extend({}, cvDefault, data.amsDatatableColvisOptions); |
|
3672 }); |
|
3673 break; |
|
3674 case 'editable': |
|
3675 checkers.push($.fn.editable); |
|
3676 sources.push(ams.baseURL + 'ext/jquery-jeditable' + ams.devext + '.js'); |
|
3677 checkers.push($.fn.makeEditable); |
|
3678 sources.push(ams.baseURL + 'ext/jquery-dataTables-editable' + ams.devext + '.js'); |
|
3679 break; |
|
3680 case 'fixedcolumns': |
|
3681 checkers.push($.fn.dataTable.FixedColumns); |
|
3682 sources.push(ams.baseURL + 'ext/jquery-dataTables-fixedColumns' + ams.devext + '.js'); |
|
3683 break; |
|
3684 case 'fixedheader': |
|
3685 checkers.push($.fn.dataTable.Fixedheader); |
|
3686 sources.push(ams.baseURL + 'ext/jquery-dataTables-fixedHeader' + ams.devext + '.js'); |
|
3687 break; |
|
3688 case 'keytable': |
|
3689 checkers.push(window.keyTable); |
|
3690 sources.push(ams.baseURL + 'ext/jquery-dataTables-keyTable' + ams.devext + '.js'); |
|
3691 break; |
|
3692 case 'rowgrouping': |
|
3693 checkers.push($.fn.rowGrouping()); |
|
3694 sources.push(ams.baseURL + 'ext/jquery-dataTables-rowGrouping' + ams.devext + '.js'); |
|
3695 break; |
|
3696 case 'rowreordering': |
|
3697 checkers.push($.fn.rowReordering); |
|
3698 sources.push(ams.baseURL + 'ext/jquery-dataTables-rowReordering' + ams.devext + '.js'); |
|
3699 break; |
|
3700 case 'scroller': |
|
3701 checkers.push($.fn.dataTable.Scroller); |
|
3702 sources.push(ams.baseURL + 'ext/jquery-dataTables-scroller' + ams.devext + '.js'); |
|
3703 break; |
|
3704 default: |
|
3705 break; |
|
3706 } |
|
3707 } |
|
3708 } |
|
3709 |
|
3710 function initTable() { |
|
3711 settings = ams.executeFunctionByName(data.amsDatatableInitCallback, table, settings) || settings; |
|
3712 try { // Some settings can easily generate DataTables exceptions... |
|
3713 var plugin = table.dataTable(settings); |
|
3714 ams.executeFunctionByName(data.amsDatatableAfterInitCallback, table, plugin, settings); |
|
3715 if (extensions.length > 0) { |
|
3716 for (index = 0; index < extensions.length; index++) { |
|
3717 switch (extensions[index]) { |
|
3718 case 'autofill': |
|
3719 var afSettings = $.extend({}, data.amsDatatableAutofillOptions, settings.autofill); |
|
3720 afSettings = ams.executeFunctionByName(data.amsDatatableAutofillInitCallback, table, afSettings) || afSettings; |
|
3721 table.data('ams-autofill', data.amsDatatableAutofillConstructor === undefined ? |
|
3722 new $.fn.dataTable.AutoFill(table, afSettings) |
|
3723 : ams.executeFunctionByName(data.amsDatatableAutofillConstructor, table, plugin, afSettings)); |
|
3724 break; |
|
3725 case 'columnfilter': |
|
3726 var cfDefault = { |
|
3727 sPlaceHolder: 'head:after' |
|
3728 }; |
|
3729 var cfSettings = $.extend({}, cfDefault, data.amsDatatableColumnfilterOptions, settings.columnfilter); |
|
3730 cfSettings = ams.executeFunctionByName(data.amsDatatableColumnfilterInitCallback, table, cfSettings) || cfSettings; |
|
3731 table.data('ams-columnfilter', data.amsDatatableColumnfilterConstructor === undefined ? |
|
3732 plugin.columnFilter(cfSettings) |
|
3733 : ams.executeFunctionByName(data.amsDatatableColumnfilterConstructor, table, plugin, cfSettings)); |
|
3734 break; |
|
3735 case 'editable': |
|
3736 var edSettings = $.extend({}, data.amsDatatableEditableOptions, settings.editable); |
|
3737 edSettings = ams.executeFunctionByName(data.amsDatatableEditableInitCallback, table, edSettings) || edSettings; |
|
3738 table.data('ams-editable', data.amsDatatableEditableConstructor === undefined ? |
|
3739 table.makeEditable(edSettings) |
|
3740 : ams.executeFunctionByName(data.amsDatatableEditableConstructor, table, plugin, edSettings)); |
|
3741 break; |
|
3742 case 'fixedcolumns': |
|
3743 var fcSettings = $.extend({}, data.amsDatatableFixedcolumnsOptions, settings.fixedcolumns); |
|
3744 fcSettings = ams.executeFunctionByName(data.amsDatatableFixedcolumnsInitCallback, table, fcSettings) || fcSettings; |
|
3745 table.data('ams-fixedcolumns', data.amsDatatableFixedcolumnsConstructor === undefined ? |
|
3746 new $.fn.dataTable.FixedColumns(table, fcSettings) |
|
3747 : ams.executeFunctionByName(data.amsDatatableFixedcolumnsConstructor, table, plugin, fcSettings)); |
|
3748 break; |
|
3749 case 'fixedheader': |
|
3750 var fhSettings = $.extend({}, data.amsDatatableFixedheaderOptions, settings.fixedheader); |
|
3751 fhSettings = ams.executeFunctionByName(data.amsDatatableFixedheadeInitCallback, table, fhSettings) || fhSettings; |
|
3752 table.data('ams-fixedheader', data.amsDatatableFixedheaderConstructor === undefined ? |
|
3753 new $.fn.dataTable.FixedHeader(table, fhSettings) |
|
3754 : ams.executeFunctionByName(data.amsDatatableFixedheaderConstructor, table, plugin, fhSettings)); |
|
3755 break; |
|
3756 case 'keytable': |
|
3757 var ktDefault = { |
|
3758 table: table.get(0), |
|
3759 datatable: plugin |
|
3760 }; |
|
3761 var ktSettings = $.extend({}, ktDefault, data.amsDatatableKeytableOptions, settings.keytable); |
|
3762 ktSettings = ams.executeFunctionByName(data.amsDatatableKeytableInitCallback, table, ktSettings) || ktSettings; |
|
3763 table.data('ams-keytable', data.amsDatatableKeytableConstructor === undefined ? |
|
3764 new KeyTable(ktSettings) |
|
3765 : ams.executeFunctionByName(data.amsDatatableKeytableConstructor, table, plugin, ktSettings)); |
|
3766 break; |
|
3767 case 'rowgrouping': |
|
3768 var rgSettings = $.extend({}, data.amsDatatableRowgroupingOptions, settings.rowgrouping); |
|
3769 rgSettings = ams.executeFunctionByName(data.amsDatatableRowgroupingInitCallback, table, rgSettings) || rgSettings; |
|
3770 table.data('ams-rowgrouping', data.amsDatatableRowgroupingConstructor === undefined ? |
|
3771 table.rowGrouping(rgSettings) |
|
3772 : ams.executeFunctionByName(data.amsDatatableRowgroupingConstructor, table, plugin, rgSettings)); |
|
3773 break; |
|
3774 case 'rowreordering': |
|
3775 var rrSettings = $.extend({}, data.amsDatatableRowreorderingOptions, settings.rowreordering); |
|
3776 rrSettings = ams.executeFunctionByName(data.amsDatatableRowreorderingInitCallback, table, rrSettings) || rrSettings; |
|
3777 table.data('ams-rowreordering', data.amsDatatableRowreorderingConstructor === undefined ? |
|
3778 table.rowReordering(rrSettings) |
|
3779 : ams.executeFunctionByName(data.amsDatatableRowreorderingConstructor, table, plugin, rrSettings)); |
|
3780 break; |
|
3781 default: |
|
3782 break; |
|
3783 } |
|
3784 } |
|
3785 } |
|
3786 if (data.amsDatatableFinalizeCallback) { |
|
3787 var finalizers = data.amsDatatableFinalizeCallback.split(/\s+/); |
|
3788 if (finalizers.length > 0) { |
|
3789 for (index = 0; index < finalizers.length; index++) { |
|
3790 ams.executeFunctionByName(finalizers[index], table, plugin, settings); |
|
3791 } |
|
3792 } |
|
3793 } |
|
3794 } |
|
3795 catch (e) { |
|
3796 } |
|
3797 } |
|
3798 |
|
3799 callbacks.push(initTable); |
|
3800 ams.ajax.check(checkers, sources, callbacks); |
|
3801 }); |
|
3802 }); |
|
3803 }); |
|
3804 } |
|
3805 }, |
|
3806 |
|
3807 /** |
|
3808 * Wizard plug-in |
|
3809 */ |
|
3810 wizard: function(element) { |
|
3811 var wizards = $('.wizard', element); |
|
3812 if (wizards.length > 0) { |
|
3813 ams.ajax.check($, |
|
3814 ams.baseURL + 'ext/bootstrap-wizard-1.4.2' + ams.devext + '.js', |
|
3815 function(first_load) { |
|
3816 wizards.each(function() { |
|
3817 var wizard = $(this); |
|
3818 var data = wizard.data(); |
3585 var dataOptions = { |
3819 var dataOptions = { |
3586 bJQueryUI: false, |
3820 withVisible: data.amsWizardWithVisible === undefined ? true : data.amsWizardWithVisible, |
3587 bFilter: data.amsDatatableGlobalFilter !== false || extensions.indexOf('columnfilter') >= 0, |
3821 tabClass: data.amsWizardTabClass, |
3588 bPaginate: data.amsDatatablePagination !== false, |
3822 firstSelector: data.amsWizardFirstSelector, |
3589 bInfo: data.amsDatatableInfo !== false, |
3823 previousSelector: data.amsWizardPreviousSelector, |
3590 bSort: data.amsDatatableSort !== false, |
3824 nextSelector: data.amsWizardNextSelector, |
3591 aaSorting: sorting, |
3825 lastSelector: data.amsWizardLastSelector, |
3592 aoColumns: columns.length > 0 ? columns : undefined, |
3826 finishSelector: data.amsWizardFinishSelector, |
3593 bDeferRender: true, |
3827 backSelector: data.amsWizardBackSelector, |
3594 bAutoWidth: false, |
3828 onInit: ams.getFunctionByName(data.amsWizardInit), |
3595 iDisplayLength: data.amsDatatableDisplayLength || 25, |
3829 onShow: ams.getFunctionByName(data.amsWizardShow), |
3596 sPaginationType: data.amsDatatablePaginationType || 'bootstrap_full', |
3830 onNext: ams.getFunctionByName(data.amsWizardNext), |
3597 sDom: sDom, |
3831 onPrevious: ams.getFunctionByName(data.amsWizardPrevious), |
3598 oLanguage: ams.plugins.i18n.datatables, |
3832 onFirst: ams.getFunctionByName(data.amsWizardFirst), |
3599 fnInitComplete: function(oSettings, json) { |
3833 onLast: ams.getFunctionByName(data.amsWizardLast), |
3600 $('.ColVis_Button').addClass('btn btn-default btn-sm') |
3834 onBack: ams.getFunctionByName(data.amsWizardBack), |
3601 .html((ams.plugins.i18n.datatables.sColumns || "Columns") + |
3835 onFinish: ams.getFunctionByName(data.amsWizardFinish), |
3602 ' <i class="fa fa-fw fa-caret-down"></i>'); |
3836 onTabChange: ams.getFunctionByName(data.amsWizardTabChange), |
3603 } |
3837 onTabClick: ams.getFunctionByName(data.amsWizardTabClick), |
|
3838 onTabShow: ams.getFunctionByName(data.amsWizardTabShow) |
3604 }; |
3839 }; |
3605 var settings = $.extend({}, dataOptions, data.amsDatatableOptions); |
3840 var settings = $.extend({}, dataOptions, data.amsWizardOptions); |
3606 if (extensions.length > 0) { |
3841 settings = ams.executeFunctionByName(data.amsWizardInitCallback, wizard, settings) || settings; |
3607 for (index=0; index < extensions.length; index++) { |
3842 var plugin = wizard.bootstrapWizard(settings); |
3608 switch (extensions[index]) { |
3843 ams.executeFunctionByName(data.amsWizardAfterInitCallback, wizard, plugin, settings); |
3609 case 'autofill': |
|
3610 ams.ajax.check($.fn.dataTable.AutoFill, |
|
3611 ams.baseURL + 'ext/jquery-dataTables-autoFill' + ams.devext + '.js'); |
|
3612 break; |
|
3613 case 'columnfilter': |
|
3614 ams.ajax.check($.fn.columnFilter, |
|
3615 ams.baseURL + 'ext/jquery-dataTables-columnFilter' + ams.devext + '.js'); |
|
3616 break; |
|
3617 case 'colreorder': |
|
3618 ams.ajax.check($.fn.dataTable.ColReorder, |
|
3619 ams.baseURL + 'ext/jquery-dataTables-colReorder' + ams.devext + '.js'); |
|
3620 break; |
|
3621 case 'colreorderwithresize': |
|
3622 ams.ajax.check($.fn.dataTable.ColReorder, |
|
3623 ams.baseURL + 'ext/jquery-dataTables-colReorderWithResize' + ams.devext + '.js'); |
|
3624 break; |
|
3625 case 'colvis': |
|
3626 ams.ajax.check($.fn.dataTable.ColVis, |
|
3627 ams.baseURL + 'ext/jquery-dataTables-colVis' + ams.devext + '.js'); |
|
3628 var cvDefault = { |
|
3629 activate: 'click', |
|
3630 sAlign: 'right' |
|
3631 }; |
|
3632 settings.oColVis = $.extend({}, cvDefault, data.amsDatatableColvisOptions); |
|
3633 break; |
|
3634 case 'editable': |
|
3635 ams.ajax.check($.fn.editable, |
|
3636 ams.baseURL + 'ext/jquery-jeditable' + ams.devext + '.js'); |
|
3637 ams.ajax.check($.fn.makeEditable, |
|
3638 ams.baseURL + 'ext/jquery-dataTables-editable' + ams.devext + '.js'); |
|
3639 break; |
|
3640 case 'fixedcolumns': |
|
3641 ams.ajax.check($.fn.dataTable.FixedColumns, |
|
3642 ams.baseURL + 'ext/jquery-dataTables-fixedColumns' + ams.devext + '.js'); |
|
3643 break; |
|
3644 case 'fixedheader': |
|
3645 ams.ajax.check($.fn.dataTable.FixedHeader, |
|
3646 ams.baseURL + 'ext/jquery-dataTables-fixedHeader' + ams.devext + '.js'); |
|
3647 break; |
|
3648 case 'keytable': |
|
3649 ams.ajax.check(window.KeyTable, |
|
3650 ams.baseURL + 'ext/jquery-dataTables-keyTable' + ams.devext + '.js'); |
|
3651 break; |
|
3652 case 'rowgrouping': |
|
3653 ams.ajax.check($.fn.rowGrouping, |
|
3654 ams.baseURL + 'ext/jquery-dataTables-rowGrouping' + ams.devext + '.js'); |
|
3655 break; |
|
3656 case 'rowreordering': |
|
3657 ams.ajax.check($.fn.rowReordering, |
|
3658 ams.baseURL + 'ext/jquery-dataTables-rowReordering' + ams.devext + '.js'); |
|
3659 break; |
|
3660 case 'scroller': |
|
3661 ams.ajax.check($.fn.dataTable.Scroller, |
|
3662 ams.baseURL + 'ext/jquery-dataTables-scroller' + ams.devext + '.js'); |
|
3663 break; |
|
3664 default: |
|
3665 break; |
|
3666 } |
|
3667 } |
|
3668 } |
|
3669 settings = ams.executeFunctionByName(data.amsDatatableInitCallback, table, settings) || settings; |
|
3670 try { // Some settings can easily generate DataTables exceptions... |
|
3671 var plugin = table.dataTable(settings); |
|
3672 ams.executeFunctionByName(data.amsDatatableAfterInitCallback, table, plugin, settings); |
|
3673 if (extensions.length > 0) { |
|
3674 for (index=0; index < extensions.length; index++) { |
|
3675 switch (extensions[index]) { |
|
3676 case 'autofill': |
|
3677 var afSettings = $.extend({}, data.amsDatatableAutofillOptions, settings.autofill); |
|
3678 afSettings = ams.executeFunctionByName(data.amsDatatableAutofillInitCallback, table, afSettings) || afSettings; |
|
3679 table.data('ams-autofill', data.amsDatatableAutofillConstructor === undefined ? |
|
3680 new $.fn.dataTable.AutoFill(table, afSettings) |
|
3681 : ams.executeFunctionByName(data.amsDatatableAutofillConstructor, table, plugin, afSettings)); |
|
3682 break; |
|
3683 case 'columnfilter': |
|
3684 var cfDefault = { |
|
3685 sPlaceHolder: 'head:after' |
|
3686 }; |
|
3687 var cfSettings = $.extend({}, cfDefault, data.amsDatatableColumnfilterOptions, settings.columnfilter); |
|
3688 cfSettings = ams.executeFunctionByName(data.amsDatatableColumnfilterInitCallback, table, cfSettings) || cfSettings; |
|
3689 table.data('ams-columnfilter', data.amsDatatableColumnfilterConstructor === undefined ? |
|
3690 plugin.columnFilter(cfSettings) |
|
3691 : ams.executeFunctionByName(data.amsDatatableColumnfilterConstructor, table, plugin, cfSettings)); |
|
3692 break; |
|
3693 case 'editable': |
|
3694 var edSettings = $.extend({}, data.amsDatatableEditableOptions, settings.editable); |
|
3695 edSettings = ams.executeFunctionByName(data.amsDatatableEditableInitCallback, table, edSettings) || edSettings; |
|
3696 table.data('ams-editable', data.amsDatatableEditableConstructor === undefined ? |
|
3697 table.makeEditable(edSettings) |
|
3698 : ams.executeFunctionByName(data.amsDatatableEditableConstructor, table, plugin, edSettings)); |
|
3699 break; |
|
3700 case 'fixedcolumns': |
|
3701 var fcSettings = $.extend({}, data.amsDatatableFixedcolumnsOptions, settings.fixedcolumns); |
|
3702 fcSettings = ams.executeFunctionByName(data.amsDatatableFixedcolumnsInitCallback, table, fcSettings) || fcSettings; |
|
3703 table.data('ams-fixedcolumns', data.amsDatatableFixedcolumnsConstructor === undefined ? |
|
3704 new $.fn.dataTable.FixedColumns(table, fcSettings) |
|
3705 : ams.executeFunctionByName(data.amsDatatableFixedcolumnsConstructor, table, plugin, fcSettings)); |
|
3706 break; |
|
3707 case 'fixedheader': |
|
3708 var fhSettings = $.extend({}, data.amsDatatableFixedheaderOptions, settings.fixedheader); |
|
3709 fhSettings = ams.executeFunctionByName(data.amsDatatableFixedheadeInitCallback, table, fhSettings) || fhSettings; |
|
3710 table.data('ams-fixedheader', data.amsDatatableFixedheaderConstructor === undefined ? |
|
3711 new $.fn.dataTable.FixedHeader(table, fhSettings) |
|
3712 : ams.executeFunctionByName(data.amsDatatableFixedheaderConstructor, table, plugin, fhSettings)); |
|
3713 break; |
|
3714 case 'keytable': |
|
3715 var ktDefault = { |
|
3716 table: table.get(0), |
|
3717 datatable: plugin |
|
3718 }; |
|
3719 var ktSettings = $.extend({}, ktDefault, data.amsDatatableKeytableOptions, settings.keytable); |
|
3720 ktSettings = ams.executeFunctionByName(data.amsDatatableKeytableInitCallback, table, ktSettings) || ktSettings; |
|
3721 table.data('ams-keytable', data.amsDatatableKeytableConstructor === undefined ? |
|
3722 new KeyTable(ktSettings) |
|
3723 : ams.executeFunctionByName(data.amsDatatableKeytableConstructor, table, plugin, ktSettings)); |
|
3724 break; |
|
3725 case 'rowgrouping': |
|
3726 var rgSettings = $.extend({}, data.amsDatatableRowgroupingOptions, settings.rowgrouping); |
|
3727 rgSettings = ams.executeFunctionByName(data.amsDatatableRowgroupingInitCallback, table, rgSettings) || rgSettings; |
|
3728 table.data('ams-rowgrouping', data.amsDatatableRowgroupingConstructor === undefined ? |
|
3729 table.rowGrouping(rgSettings) |
|
3730 : ams.executeFunctionByName(data.amsDatatableRowgroupingConstructor, table, plugin, rgSettings)); |
|
3731 break; |
|
3732 case 'rowreordering': |
|
3733 var rrSettings = $.extend({}, data.amsDatatableRowreorderingOptions, settings.rowreordering); |
|
3734 rrSettings = ams.executeFunctionByName(data.amsDatatableRowreorderingInitCallback, table, rrSettings) || rrSettings; |
|
3735 table.data('ams-rowreordering', data.amsDatatableRowreorderingConstructor === undefined ? |
|
3736 table.rowReordering(rrSettings) |
|
3737 : ams.executeFunctionByName(data.amsDatatableRowreorderingConstructor, table, plugin, rrSettings)); |
|
3738 break; |
|
3739 default: |
|
3740 break; |
|
3741 } |
|
3742 } |
|
3743 } |
|
3744 var finalizers = (data.amsDatatableFinalizeCallback || '').split(/\s+/); |
|
3745 if (finalizers.length > 0) { |
|
3746 for (index=0; index < finalizers.length; index++) { |
|
3747 ams.executeFunctionByName(finalizers[index], table, plugin, settings); |
|
3748 } |
|
3749 } |
|
3750 } |
|
3751 catch (e) {} |
|
3752 }); |
3844 }); |
3753 }); |
3845 }); |
3754 } |
3846 } |
3755 }, |
3847 }, |
3756 |
3848 |