Speed up Search Panes by providing the pre parsed JS

Speed up Search Panes by providing the pre parsed JS

yakov116yakov116 Posts: 34Questions: 5Answers: 0

Not sure how to word this.

I have a datatable that has in it 13,763 entries with one field that has in a it values split by comma which I am using orthogonal for.

columns: [
        {
            className: 'details-control',
            orderable: false,
            data: 0,
            defaultContent: '',
            render() {
                return '<i class="fa fa-plus-square" aria-hidden="true"></i>';
            },
            width: '5%',
        },
        {
            data: null,
            render(data) {
                const schoolCount = data.School.split('; ').length;
                return `${data.Report} (${schoolCount})`;
            },
            title: 'Report',
            width: '50%',
        },
        {
            data: null,
            render(data) {
                const schoolCount = data.School.split('; ').length;
                return schoolCount;
            },
            title: 'Count',
            width: '5%',
        },
        {
            data: 'File',
            title: 'File',
            width: '50%',
        },
        {
            data: null,
            render(data) {
                const schoolCount = data.School.split('; '); // This in total is over 70,000
                return schoolCount;
            },
            searchPanes: {
                orthogonal: 'schoolCount'  
            },
            visible: false,
            searchable: false,
            title: 'School',
        },
]

However that array all together is over 70,000 records.

This is causing the site to take over 5 extra seconds to load, is there a way for me to provide to search panes a pre parsed js file with the options it needs to load?

Let me know if you need more info, I can give access to the repository if needed to test.

Answers

  • yakov116yakov116 Posts: 34Questions: 5Answers: 0

    Bump

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    It's not possible to load data from a parsed js file as such, as SearchPanes will expected to get that data itself. The only approach I can think of is to disable the pane for that specific column and create a custom pane instead, something like this example here. You could populate those values from a file, either ajax source or just loaded when the page is created - it's not ideal but may give you that speed-up,

    Colin

  • yakov116yakov116 Posts: 34Questions: 5Answers: 0

    Sounds like a plan I am just not sure how I would target the array. Also the example only shows loading from existing data.

Sign In or Register to comment.