spraguey / cfgrid-lucee

CFGRID tag for the Lucee CFML engine
MIT License
3 stars 2 forks source link

Feature Request: Attribute(s) to allow changing the default (initial) sort #1

Closed michaelborn closed 7 years ago

michaelborn commented 7 years ago

Currently we're stuck with sorting in ASCending order with the first visible column only.

https://github.com/spraguey/cfgrid-lucee/blob/master/tag/grid.cfc#L389-L390

d.gridsortcolumn = '#attributes.firstVisibleColumn#';
d.gridsortdir = 'ASC';

Is there a way to sort by a specified column in DESCending order? Say a date field - descending means it shows the newest records first, which is typically what you want with date fields.

spraguey commented 7 years ago

I added new attributes for defaultSortColumn and defaultSortDir that take care of this. These features are not in the ACF version of CFGRID either. It's usually on the developer to set up their server-side query and handle the sorting there. Still, I thought this was a good idea and pretty easy to implement.