andrewcourtice / vuetiful

Vuetiful is a component framework written on top of the Vue reactive library. It is primarily designed for creating business/administration applications where the displaying of data is paramount.
MIT License
488 stars 108 forks source link

DT sort while using paginator #10

Open gozcan opened 7 years ago

gozcan commented 7 years ago

Hey, I guess when you use paginator on a datatable; since you bind paginator's page data to datatable, it only sorts displayed data rather than whole dataset. Is there a config to prevent this?

andrewcourtice commented 7 years ago

@gozcan At this stage there is no config to support this. This is by design to prevent components depending on each other. I used to have the datatable emit a sort event when you clicked the column to sort but I've since removed it while I was changing the structure of the component around.

Once I put the sort event back on the component you can just listen to that event and sort the original data based on that column. It would probably look something like this:

<paginator :source="sortedData" :page-size="5">
    <template scope="page">
        <datatable :source="page.data" @sort="sortData(columnId, direction)">
            <!-- Datatable columns & templates -->
        </datatable>
    </template>
</paginator>
manik005 commented 7 years ago

hi @andrewcourtice any workaround to achieve this ?