How to modify a column search when displaying cents as dollars? (USD)

How to modify a column search when displaying cents as dollars? (USD)

YOMYOM Posts: 53Questions: 22Answers: 1

Hey there,

Recently our team has been storing currency in cents in our database. This means when our users are searching through some of our datatable columns, they have to use cents to find the value they want in a column even though it's displayed in dollars using the render function. This is pretty counter intuitive for users.

Is there a way to override a specific column's search value in the datatables API? If not it doesn't seem that hard to do manually but utilizing the API is always preferred first

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 20,425Questions: 26Answers: 4,794
    edited October 2022 Answer ✓

    If you are using server side processing then you will need to change the dollars search value to cents for the query.

    But if you are using client side processing then use orthogonal data to set the filter operation to the dollar value you want to search. Maybe you are just returning the dollar value for the display operation so you can do the same for filter.

    Kevin

Sign In or Register to comment.