vincjo / datatables

A toolkit for creating datatable components with Svelte
https://vincjo.fr/datatables
MIT License
426 stars 14 forks source link

gettings errors in Row.js #22

Closed michapixel closed 1 year ago

michapixel commented 1 year ago

I'm getting errors when i try to re-set all Rows (reload json-Data) in Row.js orderBy is null somehow and that fails. The data i'm fetching is exactly the same.

i fixed that temporarily by catching this case in this way:

parse(orderBy) {
        // ---- INSERT
        if(orderBy === null) {
            return {
                fn: () => {},
                identifier: 'null',
            }
        }
        // ----
        if (typeof (orderBy) === 'string') {
            return {
                fn: (row) => row[orderBy],
                identifier: orderBy.toString()
            };
        }
        return {
            fn: orderBy,
            identifier: orderBy.toString()
        };
    }
vincjo commented 1 year ago

Thx @michapixel

Not sure if I reproduced the error perfectly, but it should be fixed in 1.4.1, just published.

If "orderBy" is nullish, sort, sortAsc and sortDesc methods are aborted

michapixel commented 1 year ago

Muchas gracias!

You really rock!