1

For sorting, I would like to show only one arrow aligned with the column header. I noticed that viewsortcols allows you to put the arrows horizontally (aligned nicely), but I was wondering if there were any tricks to just use a single arrow. If sorted one way it points up, the other way it points down.

I came across this grid that is doing it...but was having a little trouble understanding their code. I do not need to use custom arrows.

2Yootz
  • 3,971
  • 1
  • 36
  • 31

1 Answers1

1

The code example which you reference uses very old version of jqGrid (version 3.4.3). So it can have another behavior of sorting.

One day I misunderstand one question and have answered on exactly your question. You find the answer here. It uses the demo which create the results

enter image description here

and

enter image description here

One more answer could be also interesting for you.

UPDATED: If you want to change position of the sort icon you can do this by adding the CSS like the follow

.ui-jqgrid .ui-jqgrid-labels .s-ico .ui-grid-ico-sort {
    margin-top: 0px;
}

It will change the icon position to

enter image description here

and

enter image description here

See the modified demo.

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • A nice example...I just wish the arrow could be vertical-aligned with the title. It looks a little strange to me. I'm surprised that jqgrid doesn't offer the option. But I might use your solution if no one else has any input. Thanks for the quick reply. – 2Yootz Mar 08 '12 at 16:29
  • @Beeffingers: What you want can be done with additional CSS setting. See my updated answer. You can set `margin-top` to some another negative value like `margin-top: -1px;` if you like to place both icons higher. – Oleg Mar 08 '12 at 16:45