Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sortable on a th, td manually defined fields #61

Open
dwhudson opened this issue Sep 29, 2020 · 1 comment
Open

Sortable on a th, td manually defined fields #61

dwhudson opened this issue Sep 29, 2020 · 1 comment

Comments

@dwhudson
Copy link

dwhudson commented Sep 29, 2020

I think I'm close but it blows up the page when I apply :sortable in the wrong place. With the below code I've been able to get the two manually defined columns to work. The problem now is getting sortable to work with my date column. I've tried adding :sortable=true, :sortable="true" to the & but no luck. Since I've created the rows and columns in the template it doesn't let me do anything with it in the data() section of vue. Potentially I'm thinking props.columns.updatedOn.sortable might be the direction to go. Anyone have thoughts on how to get the Updated column to sort? Thanks again.

https://jsfiddle.net/bismarck611/tmh5k32x/
<datatable :title="titleTextCheck" :columns="tableColumns1" :rows="userSitesFilter"> <th slot="thead-tr">Updated</th> <th slot="thead-tr">Actions</th> <template slot="tbody-tr" scope="props"> <td>{{ props.row.updatedOn | formatDate }}</td> <td> <button @click="(e) => $refs.modalName.openModal(props.row, e)" class="waves-effect waves-light btn blue darken-4"> View/Edit </button> &nbsp; <button v-if="userProfile.role === 'blah'" @click=" (e) => $refs.statusChangeModalName.openStatusChangeModal(props.row, e)" class="waves-effect waves-light btn blue darken-4"> Status </button> </td> </template> </datatable>

@MicroDroid
Copy link
Owner

A sortingFunc property in columns would be a good idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants