Custom sort function on load is not invoked #1167

wants to merge 5 commits into


None yet

3 participants

ryanwawr commented Oct 31, 2016 edited

Added to fix issue #553 . If the sort field for a table is a column with a custom sort function, the 'customSort' event will not be emitted when the table is first loaded, since 'sortColumn' is not set.

I added a line to the condition in sortSingle() that will also emit the 'customSort' event if

  1. 'SortField' is set
  2. The column whose 'field' property matches 'sortField' has its 'sortable' field set to 'custom'
ryanwawr and others added some commits Sep 21, 2016
@ryanwawr ryanwawr changed the title from Custom sort on load to Fix issue #553: Custom sort on load Nov 16, 2016

But sortColumn still won't be set so how could the sortFunction be emitted?

@cagataycivici cagataycivici self-assigned this Dec 20, 2016
@cagataycivici cagataycivici added this to the 1.1.1 milestone Dec 20, 2016
@cagataycivici cagataycivici changed the title from Fix issue #553: Custom sort on load to Custom sort function on load is not invoked Dec 20, 2016
@cagataycivici cagataycivici added a commit that closed this pull request Dec 20, 2016
@cagataycivici cagataycivici Fixed #1167 583e891

Please review 583e891

It sets it before sorting if sortColumns is not available on load.


Ah, you're right. I missed setting sortColumn, but it looks like your commit should resolve the issue. Thanks!

@ryanwawr ryanwawr deleted the ryanwawr:customSortOnLoad branch Dec 20, 2016
JiroDan commented Dec 27, 2016

Doing this in onDoCheck means that you must check to see if the columns are bound first;
634: if(!this.sortColumn && this.columns) {

Otherwise it throws, Cannot read property 'find' of undefined: 635

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment