markSorting ASC requires an extra click on the header for the table to filter DESC

It is clear from this example: http://docs.webix.com/samples/15_datatable/02_sorting/03_sort_api.html

How to reproduce:

  1. Click on “sort by title” button
  2. Then click on the “Title” header cell - nothing happens :frowning:
  3. Then click on the “Title” header cell again - now it finally filters DESC

From 2.1.14 debug.js:

markSorting:function(column, order){
if (!this._sort_sign)
this._sort_sign = webix.html.create(“DIV”);
webix.html.remove(this._sort_sign);
if (order){
var cell = this._get_header_cell(this.getColumnIndex(column));
if (cell){
this.sort_sign.className = "webix_ss_sort"+order;
cell.style.position = “relative”;
cell.appendChild(this._sort_sign);
} else {
this._last_sorted = column;
this._last_order = order;
}
}

As can be seen from the code, internal variables this._last_sorted and this._last_order are only set if the header cell is not found (before initialization).

Workaround (hack) is to call “markSorting” once on the “onStructureLoad” event (when the “cell” is not yet initialized) and then again when you need to.

Hope this helps improve Webix!

Thanks for the above info. I can confirm the problem.

Fix will be included in the oncoming Webix 2.2