jquery ui - How to sort prime-ui datatable, based on more than one column -
i want sort datatable based on 2 columns. if use following property,
{sortfield: 'columnheader'}
its not working.
it not work current primeui (at time of answer 1.1
). have @ sort function:
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 can see uses array.prototype.sort() function , accesses field-to
var value1 = data1[field], value2 = data2[field],
maybe can override particular function , use own sort
method instead.
Comments
Post a Comment