RoXuS / paper-datatable-api

A material design implementation of a data table
https://roxus.github.io/paper-datatable-api/components/paper-datatable-api/#paper-datatable-api
GNU General Public License v3.0
72 stars 17 forks source link

Sort #45

Open papusa opened 7 years ago

papusa commented 7 years ago

Hi,

How does sorting works? Does it require only sortable attribute to be set to true or needs some additional handlers?

In demos here: https://roxus.github.io/paper-datatable-api/components/paper-datatable-api/#paper-datatable-api sorting doesn't work on chrome (Version 58.0.3029.110 (64-bit)), but works on firefox. Locally sort is not working on any browser.

Thanks

RoXuS commented 7 years ago

Hello @papusa,

Sort works on my Chrome (same version).

You have to do the sort on your backend or with a specific function (see https://github.com/RoXuS/paper-datatable-api/blob/master/demo/advanced-pagination-front-side-demo.html).

drdreo commented 7 years ago

Hi, im very happy that i've found a working paper-datable component now after days of searching for some that is still developed. Nonetheless, i think this is quiet the right place for this issue.

If i click on sort, whether with my implementation of your sort algorithm or yours on your demo here:

It gets sorted, fine. But if you continue spamming the sort button, you have to click twice when the arrow points downwards to get it sorted the other way. What causes that?

RoXuS commented 7 years ago

Hi @drdreo,

Yeah it is normal you return to the "normal" state.

The steps are : normal state (without specific order) -> order by desc -> order by asc -> normal state...etc

vsobolmaven commented 5 years ago

Hi @drdreo,

Yeah it is normal you return to the "normal" state.

The steps are : normal state (without specific order) -> order by desc -> order by asc -> normal state...etc

Would be nice to have sort icon indicate that normal state. Currently, the icon by the column shows it is either ascending or descending only.

vsobolmaven commented 5 years ago

The other issue with sorting behavior I encountered was that on-sort callback from paper-datatable-api is invoked when the data property is updated and what is strange the event.detail.sort parameter of the handler is reset to empty ({}). Is that something expected?

Here is a stack trace from a call when the data is set and it goes up to _handleSort.

  | _handleSort | @ | maven-md-table.js:149
-- | -- | -- | --
  | handler | @ | template-stamp.html:92
  | fire | @ | legacy-element-mixin.html:393
  | forEach | @ | paper-datatable-api.js:580
  | _sortChanged | @ | paper-datatable-api.js:570
  | runMethodEffect | @ | property-effects.html:818
  | runEffectsForProperty | @ | property-effects.html:162
  | runEffects | @ | property-effects.html:128
  | _propertiesChanged | @ | property-effects.html:1711
  | _flushProperties | @ | properties-changed.html:341
  | _flushProperties | @ | property-effects.html:1559
  | _invalidateProperties | @ | property-effects.html:1531
  | _setProperty | @ | property-effects.html:1516
  | Object.defineProperty.set | @ | properties-changed.html:150
  | _setColumns | @ | paper-datatable-api.js:483
  | flush | @ | flattened-nodes-observer.html:274
  | Polymer.Async.microTask.run | @ | flattened-nodes-observer.html:195
  | microtaskFlush | @ | async.html:31
  | characterData (async) |   |  
  | run | @ | async.html:190
  | _schedule | @ | flattened-nodes-observer.html:195
  | FlattenedNodesObserver | @ | flattened-nodes-observer.html:133
  | observeNodes | @ | polymer.dom.html:63
  | _dataChanged | @ | paper-datatable-api.js:245
  | runObserverEffect | @ | property-effects.html:217
  | runEffectsForProperty | @ | property-effects.html:162
  | runEffects | @ | property-effects.html:128
  | _propertiesChanged | @ | property-effects.html:1711
  | _flushProperties | @ | properties-changed.html:341
  | _flushProperties | @ | property-effects.html:1559
  | __enableOrFlushClients | @ | property-effects.html:1604
  | _flushClients | @ | property-effects.html:1579
  | _propertiesChanged | @ | property-effects.html:1707
  | _flushProperties | @ | properties-changed.html:341
  | _flushProperties | @ | property-effects.html:1559
  | _invalidateProperties | @ | property-effects.html:1531
  | set | @ | property-effects.html:1866

I am running Chromium 70.0.3538.77 and recent paper-datatable-api v2.0.18. Thank you.