5

Happy New Years Eve!

I would like to be able to set the default for value some columns to descending. So, the first time the user clicks on that column, it sorts descending by nature.

I have no problem setting the default sort field and order of my grid. But that is all the info I am finding.

$grid->setGridOptions(array(

"caption"=>"Player Statistics",
"rowNum"=>200,
"rowList"=>array(50,200,1000),
"sortname"=>"percentOwned",
"sortorder" => 'desc',
"width" => 1000,
"height" => 400,
"hoverrows" => true,
"viewrecords" => false

));

How do I set the default sort to descending on a per column basis? Is it possible?

Thanks!

DisplayName
  • 3,093
  • 5
  • 35
  • 42
Bryan
  • 17,201
  • 24
  • 97
  • 123

1 Answers1

6

Although not in the documentation, 'firstsortorder' => 'desc' does the trick.

$grid->setGridOptions(array(
'firstsortorder' => 'desc'
"caption"=>"Player Statistics",
"rowNum"=>200,
"rowList"=>array(50,200,1000),
"sortname"=>"percentOwned",
"sortorder" => 'desc',
"width" => 1000,
"height" => 400,
"hoverrows" => true,
"viewrecords" => false
));
Bryan
  • 17,201
  • 24
  • 97
  • 123
  • That looks like it will apply to every column. This attribute also works for each column by setting it in the column's model. I do not know how to do that for the PHP version, however. – David Harkness Jan 15 '16 at 22:50