I use Fly on UI datatable, how do I use the footerCallback function

I use Fly on UI datatable, how do I use the footerCallback function

SteilSteil Posts: 3Questions: 2Answers: 0

It doesn't work that way

 <div id="datatable-with-export" data-datatable='{
                "pageLength": 15,
                "ordering": false,
                "scrollY": "470px",
                "pagingOptions": {
                    "pageBtnClasses": "btn btn-text btn-circle btn-sm"
                },
                "layout": {
                    "top2": "searchPanes",
                    "top1": {
                        "buttons": [
                            {
                                "extend": "copy",
                                "className": "btn btn-primary btn-outline btn-sm",
                                "text": "Копировать"
                            },
                            {
                                "extend": "csv",
                                "className": "btn btn-primary btn-outline btn-sm",
                                "text": "CSV"
                            },
                            {
                                "extend": "excel",
                                "className": "btn btn-primary btn-outline btn-sm",
                                "text": "Excel"
                            }
    
                        ]
                    }
                },
                "searchPanes": {
                    "controls": true,
                    "layout": "columns-2",
                    "cascadePanes": true,
                    "initCollapsed": true,
                    "i18n": {
                        "collapseMessage": "Скрыть фильтры",
                        "showMessage": "Показать фильтры",
                        "clearMessage": "Сбросить фильтры",
                        "title": "Активные фильтры - %d"
                    }
                },
                "columnDefs": [
                    {
                        "searchPanes": {
                            "show": true
                        },
                        "targets": [0]
                    }, 
                    {
                        "searchPanes": {
                            "show": true
                        },
                        "targets": [1]
                    },
                    {
                        "searchPanes": {
                            "show": false
                        },
                        "targets": [2]
                    },
                    {
                        "searchPanes": {
                            "show": false
                        },
                        "targets": [3]
                    },
                    {
                        "searchPanes": {
                            "show": false
                        },
                        "targets": [4]
                    }
                ]
            }'
<script>
    window.addEventListener('load', () => {
        const dataTable = new HSDataTable('#datatable-with-export', {
                columnDefs: [
                    {
                        targets: [-1],
                        render: function(data, type, row) {
                            var cleanedData = data.replace(',', '.');
                            var num = parseFloat(cleanedData).toFixed(2);
                            return isNaN(num) ? '' : num;
                        }
                    }
                ]
        });
    });
</script>

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 64,411Questions: 1Answers: 10,635 Site admin

    Thanks for your question. As noted in the forum rules, please post a link to a running test case showing the issue so we can offer some help. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Allan

  • SteilSteil Posts: 3Questions: 2Answers: 0

    no, can I just explain how to use the datatable functions in a third-party plugin? just creating a test case will take too much time.

  • allanallan Posts: 64,411Questions: 1Answers: 10,635 Site admin
    Answer ✓

    The problem is that I don't see anything wrong with the above. I don't know what HSDataTable is, or how data-datatable is being parsed.

    The flip side of a test case taking too much time to prepare, is that without enough information, it will take too much time for me to provide free support.

    Allan

Sign In or Register to comment.