How to sort on state

How to sort on state

fpakayfpakay Posts: 6Questions: 2Answers: 0

EG: Charlotte, NC

How can I sort on the state as in the example above.
I would also like to sort on last name. EG: John Doe

Answers

  • kthorngrenkthorngren Posts: 19,138Questions: 26Answers: 4,536

    For either one you can create a sorting plugin or you can use Orthogonal data to set the sorting value to the state or lastname.

    Kevin

  • fpakayfpakay Posts: 6Questions: 2Answers: 0

    Thanks Kevin.

  • fpakayfpakay Posts: 6Questions: 2Answers: 0

    Looked at the two options above, however I do not understand either. Any one have an example? That would be very much appreciated.

  • allanallan Posts: 59,799Questions: 1Answers: 9,682 Site admin
  • allanallan Posts: 59,799Questions: 1Answers: 9,682 Site admin

    If you post an example of what you've got at the moment we can look at how it might be best modified.

    Allan

  • fpakayfpakay Posts: 6Questions: 2Answers: 0

    This is a typical datagrid where I would like to sort on last name.

  • kthorngrenkthorngren Posts: 19,138Questions: 26Answers: 4,536
    edited May 12

    Here is an example of sorting by last name:
    https://live.datatables.net/yuwosuwu/1/edit

    It uses Orthogonal data to manipulate the original data to the data to sort on for the sort operation. For example:

          render: function (data, type, row) {
            if (type === 'sort') {
              return data.split(' ')[1];
            }
            return data;
          }
    

    You can do something similar with the state.

    Kevin

Sign In or Register to comment.