-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add column sorting #7
Comments
The proposal for
I'm not a big fan of signatures with n args, but it does seem like a simple way to support multi-column sort and direction. Feedback welcome. |
The yuilibrary.com ticket tracking this issue is http://yuilibrary.com/projects/yui3/ticket/2531130 |
From a lengthy conversation in #yui, it was agreed that sorting should be applied to the DT's ML directly. If an implementer wants a data set that maintains a specific order, they should maintain that data in a separate ML and just share its Models in the DT's ML. |
More feedback from #yui discussions:
|
There's an awkward issue when trying to make a column sortable whose content is generated by a formatter. The options, it seems to me are:
(1) is the current requirement, but is undesirable because sorting would lose fidelity from rendered content, though Another issue is that the ModelList's sorting algo doesn't support multi-key/complex sorting. The Another result of the The plan for the sortable extension was to set the |
I think we can solve the sorting issues fairly easily by making a couple of changes to ModelList:
This makes How does this sound? |
LGTM |
Pushed to master |
Class extension that auto-mix()es onto
Y.DataTable
Should provide a method
sort(keyOrColIndex, descending?)
orsort(keyOrIndex[, keyOrIndex]*)
on the DataTable proto.Should provide a
sortable
attribute that accepts:columns
config for columns defined withsortable: true
Since sorting can be considered a UI-specific operation[1], the implementation might leverage ModelList's sorting capability, but do so by assigning the
data
Models to an alternate ML implementation that had the sorting in place for thebodyView
instance. The view ML should be synced to the DT ML via events, but there should be almost no memory overhead, since no new Models would be created, although there would be some risk that the DT's ML included an additional API that a custombodyView
expected to be in place.An additional challenge is how a DT class extension would apply the sort arrow UI to the header cells. One idea would be to do this with a Plugin which was applied to the
headerView
instance. Since header rendering is not a performance vector, another option would be to have the class extension apply anafter('render')
to add the sort arrows. On the face of it, I prefer the Plugin idea, because there's room to configure the specific sort plugin with an additional DT attribute, contributed by teh class extension.[1] Technically speaking, order is state, but a UI sort doesn't necessarily represent a data state change.
The text was updated successfully, but these errors were encountered: