Sort Button Control

The Sort Button Control is used to sort HTML elements using links or buttons. It is possible to sort text and numerical content.

This control is added in DataGrid v1.0.2

<a
    href="#"
    data-id="my_button"
    data-grid-control="sort-button"
    data-path=".first-name"
    data-direction="asc"
    data-toggle-direction
    data-type="text">First Name</a>

It also can be a button:

<button 
    type="button" 
    data-id="my_button"
    data-grid-control="sort-button"
    data-path=".first-name"
    data-direction="asc"
    data-toggle-direction
    data-type="text">First Name</button>

Select data attributes

Sort Types

The control supports the following CSS classes:

.dg-asc{
  /* when the control in the ASC state */
} 

.dg-desc{
  /* when the control in the DESC state */
} 
 
 .dg-sort-selected{
   /* when the control in the latest 
     clicked between other sort buttons 
     with the same data-id
   */
}

Last updated