Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
615
Specifying an initial column to sort on when igGrid is first rendered
posted

I'm sure i'm missing it, but I have not seen a way to configure the igGrid to initially sort on a specific column and sort direction when the igGrid is first displayed.  Can you shed any light on this?

Thanks.

Parents
  • 17590
    Offline posted

    Hello epsiwebdev,

    Thank you for posting in our community.

    What I can suggest is using Sorting features columnSettings. This is a list with columsn settings that specify custom sorting settings for a specific column(whether sorting is enabled/disabled,default sort direction etc.). You could specify the column that you you would like to sort by its key and set it sorting direction. For example:

      $("#grid").igGrid({
                    dataSource: data,
        features:[
         {
          name: "Sorting",
           columnSettings : [
                    {
                         columnKey: "Age",
                         allowSorting: true,
                         currentSortDirection: "descending"
                    }
                ]
         }
         ]  

    I created a small sample illustrating my suggestion and I am attaching it or your reference. In my sample Age columns is initially sorted in descending direction.

    Please have a look at my sample and let me know whether it helps you achieve your requirement.

    I hope you find my information helpful.

    Pleas elet me know if you have any additional questions regarding this matter.

    igGridSortColumnsInitially.zip
Reply Children