Column sorting not working with custom key
I have updated the theme and seems the column sorting not working in ktdatatable
I have written my issue below. Please check and let me know the solution for it.
const tableHeader = ref([
{
columnName: "Email",
columnLabel: "email",
sortEnabled: true,
columnWidth: 80,
},
])
{{data.user.email}}
Thank you!
Replies (7)
Could you please provide us with more info? What is your Metronic version and framework(React, Angular, Vue, or HTML)?
We have the latest version of theme and using the Vue js framework
Hi,
If you were using an older version of our KTDatatable components, then client pagination was handled by our component, it was changed in new versions of KTDatatable.
Now you need to pass a function using on-sort component event then you should handle a sorting inside this function.
Please refer to file src/views/apps/customers/CustomersListing.vue in latest Metronic version for a demos, also check our KTDatatable doc.
I have used on-sort component same as the latest theme
My question is if I use column data with data.user.name then the sorting for this column is not working. if I use data.name then it works fine.
Please let me know if you have any confusion.
Hope you understand my question.
Thank you!
Hi,
Could you please attach the code of your on-sort function?
const tableHeader = ref([
{
columnName: "sr",
columnLabel: "index",
sortEnabled: false,
columnWidth: 20,
},
{
columnName: "Name",
columnLabel: "name",
sortEnabled: true,
columnWidth: 175,
},
{
columnName: "Email",
columnLabel: "email",
sortEnabled: true,
columnWidth: 250,
},
{
columnName: "Website",
columnLabel: "website",
sortEnabled: true,
columnWidth: 100,
isAllowEdit: true,
},
{
columnName: "Status",
columnLabel: "status",
sortEnabled: false,
columnWidth: 70,
},
{
columnName: "Action",
columnLabel: "action",
sortEnabled: false,
columnWidth: 135,
},
]);
{{ data.user.name }}
{{ data.user.email }}
{{ data.website }}
--
Please check this code in this page Name and Email sorting is not working
Hi,
Look like your code format was broken, can you please format it correctly?
Check "Text formatting options" under the field.