Skip to content
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

Lock columns out of draggable header re-ordering #64

Closed
wants to merge 3 commits into from

Conversation

editedredx
Copy link

Allows the locking of columns so they wont participate in the manual column ordering.

@muthukumarse
Copy link
Contributor

@6pac @ghiscoding - can we see this feature, let me know if you want to patch the conflict.
I like this feature, i may use it.

@6pac
Copy link
Owner

6pac commented Mar 2, 2018

There's been a conversation about this before, but I can't find it.
The problem I have is that if a column in the centre is locked, how do reordered columns move around it, ie. which columns go on one side and which on the other?
It really only makes sense for the first and last columns. In that case, it's more specific.

@ghiscoding
Copy link
Collaborator

ghiscoding commented Mar 2, 2018

I used UI-Grid for some time with AngularJS and they called it Pinning and you had to choose which side you want to pin (left or right) and how many columns you want to pin. Obviously you can't pin something in the middle, you can pin the first 2 columns but you can't pin column 2 without column 1 which makes sense, that would be the same thing in Excel

@6pac
Copy link
Owner

6pac commented Mar 2, 2018

Ah yes, right about the multiple adjacent cols.
There's been an ongoing discussion about the JLynch branch frozen columns, and I'm interpreting frozen as being able to freeze say the first two columns and then scroll the rest of the columns off to the left, leaving the two frozen columns intact.
This is different, and a lot easier, it's just pinning the first two columns say, and then allowing the other columns to be able to be reordered.

I'd prefer if the option was something like pinMode=none, left, right and pinColCount=n, it's messy at the moment, although I suppose if it's used correctly it will lead to the same result.

@muthukumarse
Copy link
Contributor

@6pac - pinMode=none/left/right and pinColCount=n is good approach.

@ghiscoding
Copy link
Collaborator

but does this PR actually do Pinning? I thought lock actually meant something else.

Allows the locking of columns so they wont participate in the manual column ordering.

This is kind of confusing, perhaps I should try the demo.
Do you guys know if it does Pinning of something else?

@6pac
Copy link
Owner

6pac commented Mar 2, 2018

Yeah, I'm confused. Likewise, I should try the demo.

@6pac
Copy link
Owner

6pac commented Mar 4, 2018

Looks like it does what I thought, just prevents the chosen columns from participating in the column reorder, ie. the locked column header cannot be dragged. I suspect this doesn't prevent a draggable column being dragged to the left or right of the locked columns though, so it may need some more work. The locked columns are disappearing on reorder for me as well, that appears to be a bug. This is patched onto quite an old version of the grid.

Do you think this is really worth the trouble?

@muthukumarse
Copy link
Contributor

@6pac - if you have time you should do. since this is one of the good feature as like as Excel.
like in my case i does, but i did patching locally with css - which is not right.

if you bring this feature definitely its worth. 👍

@ghiscoding
Copy link
Collaborator

ghiscoding commented Mar 6, 2018

@6pac
I did a checkout of this PR and this is not the pinning functionality. It's a simple column lock which blocks the user from being able to reorder the column (e.g. drag 2nd column to display as the 3rd column). The example provided in the sample locks the column Title, so I can move (drag) any other columns, drag them and change their position in the grid, except the Title column because that one is locked.

I think it's still a nice functionality and it's not that big to implement, however this PR has conflicts since the PR is rather old. Not too hard to replicate if the original author or anyone else want to redo the PR.

@6pac
Copy link
Owner

6pac commented Mar 6, 2018

It might be worth using mode: none, lockLeft, lockRight, pinLeft, pinRight for future pinning.

The thing is, I'm pretty sure with the PR as it is, while you can't drag a locked column to reorder, I'm pretty sure you could drag one of the draggable columns to the left or right of the locked column. Which makes this all a bit foolish without further changes.

It just seems quite a bit of work for not a great feature.

@SatanEnglish
Copy link
Contributor

@6pac, @ghiscoding
I want something like this for locking the checkbox on the left side.
Doesn't really make scene to let people move the checkbox around.
Same with the new detail view the column with the icon would be nice to be locked.

Also If you ask me if you setup your grid and lock the middle column and no other it's the developers fault not your in regards to dragging to either side of a locked column.

So if it's not to hard to do allowing for locking and noting that it only works for left or right hand side of the columns should be enough.

Although I'm not sure what would happen if you turn on more columns in the case of the right hand side.

@ghiscoding
Copy link
Collaborator

@SatanEnglish
As I mentioned earlier and after trying this PR, it is not pinning functionality.
What you are looking for is pinning functionality.

Let me rename the title to remove this ambiguity.

@6pac
Perhaps we should close this PR? People keep thinking it's pinning

@ghiscoding ghiscoding changed the title Lock columns Lock columns out of draggable header re-ordering Mar 8, 2018
@6pac
Copy link
Owner

6pac commented Mar 9, 2018

@ghiscoding I'm not sure they do think that, actually. There definitely is some confusion, particularly with new arrivals, but this is possibly a legitimate non-pinning feature. That's why I'm trying to established some agreed-upon terminology, perhaps 'locked' and 'pinned' are the best? 'Frozen' is the best alternative to 'pinned'.

But as I mentioned previously, even if we lock the two left hand columns, I can't see why someone couldn't drag the third (unlocked, draggable) column to the left of the first column. It needs more work on the dragging logic.

I'm not sure it's worth the trouble making this feature. Adding true pinning wouldn't be that hard, I just don't think I'm going to have around 10 hours of time to do it.

@ghiscoding
Copy link
Collaborator

ghiscoding commented Mar 9, 2018

Yes but again this PR is just re-ordering of draggable columns. It's far from being pinning/frozen (it's called Frozen Pane in Excel) or whatever you want to call it. I also don't have the 10 hours to spend, though I'm happy we got the row detail plugin done :) Perhaps someone will have time to do it eventually.

@SatanEnglish
Copy link
Contributor

@ghiscoding
Nope NOT wanting pinning. Pinning would mean if I scroll right the checkbox would stay on view.
I just don't want ppl able to drag the checkbox column into another order. (Locked)

E.g. Making the checkbox only ever allowed to be in the first column. (no dragging it and no dragging stuff before it)

I'm also not likely to find 10 hours.

The detail plugin is already being used in a couple of my new web pages.

@kjn2
Copy link

kjn2 commented Mar 16, 2018

http://jlynch7.github.io/SlickGrid/examples/example-frozen-columns.html

This is a good example for frozen column(s)

@6pac
Copy link
Owner

6pac commented Mar 16, 2018

... and check out this: #26

@ghiscoding
Copy link
Collaborator

closing this PR since it is really out of date and will be even more once we release our upcoming Roadmap to v4.0 - jQuery removal. We can re-discuss it in the future

@ghiscoding
Copy link
Collaborator

better late than never... I brought back this idea in PR #983
This is much easier to implement now that we use SortableJS for the column reodering, we can take advantage its filter option to bring this functionality. I named the new column option as reorderable (defaults to true)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants