I want to sort the datatable based on 2 columns. If I use the following property,
{sortField: 'ColumnHeader'}
Its not working.
It will not work with the current primeui (at the time of this answer it is 1.1). Have a look at the sort function:
1.1
sort: function(field, order) { if(this.options.selectionMode) { this.selection = []; } if(this.options.lazy) { this.options.datasource.call(this, this._onLazyLoad, this._createStateMeta()); } else { this.data.sort(function(data1, data2) { var value1 = data1[field], value2 = data2[field], result = (value1 < value2) ? -1 : (value1 > value2) ? 1 : 0; return (order * result); }); if(this.options.selectionMode) { this.selection = []; } if(this.paginator) { this.paginator.puipaginator('option', 'page', 0); } this._renderData(); } },
As you can see it uses the Array.prototype.sort() function and accesses the field-to
var value1 = data1[field], value2 = data2[field],
Maybe you can override this particular function and use your own sort method instead.
sort
http://www.primefaces.org/primeui/#datatableSort
Its available in Prime UI version 4.1.3
It will not work with the current primeui (at the time of this answer it is
1.1). Have a look at the sort function:As you can see it uses the Array.prototype.sort() function and accesses the field-to
Maybe you can override this particular function and use your own
sortmethod instead.