coreui/coreui-vue

CSmartTable sorting on nested properties, cleaner

plundermun opened this issue · 6 comments

I use CSmartTable with external data loading, filtering and sorting.
My items look like
[ { name: 'test', address:{ street: 'teststreet', nr: '1', zip: 'XXX' } }, ..... ]

My cols look like
const cols = [ {key: 'name', label: 'Name'}, {key: 'address.street', label: 'street'}, ...

on the table I have set
:columnFilter="{ external: true}"
:columnSorter="{ external: true}"

and I also have set handlers for the events @column-filter-change and @sorter-change

Now for the bugs or maybe I'm doing something wrong.

While the Filter event gets fired when I filter on nested columns e.g. address.street the sort event is not fired.
When I try to sort on those columns only
component:CSmartTableHead event:"sortClick" params:Array[2] 0:"address.street" 1:5
gets fired.

Also when I set cleaner on the table, no event gets fired that I can listen for, no @column-filter-change and no @sorter-change nor a specific event from the cleaner component.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions

Nope still an issue.
Also I sent in the support request for this in august thru the customer support via pro support on your website.
Haven't got the slightest answer till today, not even a 'ticket was created' auto reply.
I would have been even happy with a sry it's not possible reply, but no reply at all.

@plundermun I'm working on it.

I know where is the issue, our SmartTable doesn't work with nested objects, we're working on this feature and it will be available in future releases.

You should convert
[ { name: 'test', address:{ street: 'teststreet', nr: '1', zip: 'XXX' } }, ..... ]

to

[ { name: 'test', address_street: 'teststreet', address_nr: '1', address_zip: 'XXX' } }, ..... ]

and then

const cols = [ {key: 'name', label: 'Name'}, {key: 'address_street', label: 'street'}, ...

Yeah the problem is only that one have to do a lot of conversions and this kinda breaks simple property path addressing.
just to be clear, I do the sorting with "external" so it would be sufficient enough if the table would just emit an event, it doesn't need to do the sorting cause I do it server side.
The CSmartTableHeader emits the sortClick event but I guess it doesn't get further propagated cause it doesn't pass the isSortable function.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions