-
Notifications
You must be signed in to change notification settings - Fork 426
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
feat: Column 'hidden' property #738
Conversation
what does |
Yes, there is only the one The way I see it is that no existing code will have or use the .hidden properly on the column. Therefore it won't be breaking - all columns will just be visible all the time on legacy code. I just think it's complicating things a lot having a getVisibleCols/getHiddenCols/getAllCols method. Will work on the merge conflicts - I'm still a bit new to cross-branch applying of commits. |
The problem that I see with this change is that every users are expecting For the merge conflict, I use switch back to |
Hey @ghiscoding, I'm not trying to be pushy here, but we keep disagreeing on one thing, and I don't think we can move forward sensibly on this before we sort it out.
All we are doing is adding a So, how is this a breaking change? As far as I can see, it's simply a new non-breaking feature. If a user decides to start using the feature, then they will have to adjust their code accordingly (which will be a significant simplification). I suppose if we re-tooled all the add-ins that 'hide' columns by removing them to use the new The challenge is making the use of the new |
Perhaps I misunderstood but the current contract (interface wise), since the creation of the library, is that To not break the interface contract of only returning visible columns by default, you could simply add an argument as I mentioned earlier and that will not modify the old contract since we would only add new things via the new argument and that will not entirely change the return output function getMethods(includeHidden) {
if (includeHidden) {
return columns; // will return visible + hidden
}
// return only visible columns
// this would keep the legacy interface contract
return columns.filter(c => !c.hidden);
} I'm not sure if this is the correct code since |
OK, this is good - now we're getting down to it.
As far as I understand it, at the moment the library has no concept of a hidden column. There are only columns, and all columns are displayed. It is incorrect to say that To me, it makes sense to add the concept of a 'hidden' column to the grid. If we do so, then we can pass a full set of columns into the grid and just toggle the The task in adding the property is to make sure that if it *is * used, then it works properly with all current grid features. This will enable developers to get rid of the existing external 'hidden column' logic. We can keep the external logic in some plugins etc if necessary, but ideally we would offer two versions, one with hidden column support and one without. |
Sadly, It looks like you still don't want to use my suggestion though and if you don't then I still think you are breaking the contract, if yesterday the method returns only visible columns and tomorrow it returns visible + hidden then Yes to me that is a break in the contract because the output is very different. If you do make the method return visible + hidden columns, then we'll have to refactor the Column Picker, Grid Menu and maybe other plugins and we'll need to advise users of the breaking change... but if you instead apply my suggestion to your change, then we wouldn't to refactor at all and it wouldn't be a breaking change. So I'm wondering, why do you still want to go without my suggestion? I always try to avoid breaking change when I can and we could do it in this situation. I think your PR would be totally fine with my small 1 extra argument and this would having me do a lot of refactoring in my libs (I plan to refactor in the future but with my suggestion, I wouldn't have to do it right away, I could wait and do it whenever I please, it would also not break users)... basically if you intend to ship your code as it is, it has to be shipped under a |
Hi @ghiscoding, sorry for the long pause, I've just been busy. Let's be clear, I still don't agree that there's a contract to return visible columns - it should return all columns - that's exactly what it has aways done. To me, making the change you suggested is breaking that contract, and it just feels really weird to me. Nor do I think that it's a breaking change to existing code. As always, I'm more than happy to be proven wrong. Can you provide an example where it would be breaking? Anyway, you're clearly quite determined about this, and I do understand that you would have to do some refactoring on your libraries - that is something that I accept, so I'll have more of a think about your suggestions on the weekend when I have a bit more brain space. |
Perhaps I didn't explain myself properly, when I say contract I mean "what we have today" and when I say your change will break the contract I mean "what we'll have tomorrow". So today it returns only visible columns and tomorrow you want it to return all columns, so to me this is a breaking change to the user and it cannot be under v3.x, it will have to be under v4.x. For example, I am 100% sure that this PR would change how my libs works and I will for sure have to do some changes to my libs, because again to me, this is a breaking change since the result would be different. My proposed change was to avoid the breaking change but still provide a way to return all columns as you wish to do with this PR. |
LOL. This is taking up waaaay too much conversation space. So you've said
I do understand exactly what you're saying, and I do understand what a contract is, but I don't agree with what you're saying, and I don't think you're hearing me. In my mind, the contract is that I don't understand why we would have a contract to return only visible columns. So then. If I were being dramatic I could say that from my point of view, your proposal is changing the contract and if we release it we would have to increment the major version number. I'm not trying to push that point but I'm saying all your assertions about it being a breaking change follow from your assertion about the nature of the contract. But if you take my position for a moment, you'd see that in that case, since the users don't have the concept of isHidden yet, how could it be breaking? If they don't use isHidden, literally nothing changes. OK, enough philosophising. What I'd really like to do is add a new method I think this makes the behaviour a lot clearer. Adding a flag to Anyway, you are at this point the main maintainer of the project so if you are still determined, then I can make the concession. |
What I wanted to highlight by saying that it doesn't follow the contract is basically that your change is a breaking change, that's mainly all I wanted to say. If you want to go ahead by adding As for the removal of jQuery, I started testing it with my libs, I found some small issues that I provided fixes. I'll see if the user can make the change, if not, we can maybe merge it anyway since it's on the |
@6pac would it be possible to rebase your PR against the |
OK, @ghiscoding, two things.
I just noticed that in this first part of
The code is bailing from the loop using
which worked when the loop was jQuery
but should be
I will post the new 'hidden-columns-next' branch as a new PR soon, once the iteration issue is taken care of. |
oh right, good catch, I assume that you are right by using
Yeah I prefer separate PRs since they are separate subjects, you might be better of closing this PR and create a new one against On my side, the migration is going quicker than I expected and I think I'll be done by next week. It helps that I have already done the migration in my own libs of all Controls & Plugins, I just have to compare and copy over the code that changes. So if you have time to make this PR, that'd be great and we could go with a Beta pretty soon. Cheers |
@6pac so are you having any progress on this hidden column feature? Or should we ship a 4.0 Beta without this feature? I'm simply asking because I expect to be done this week with all of things that I wanted to address before releasing anything. If you're too busy, I would be happy with a Beta release (I'll let you know when) so that I can finish the implementation and testing in my other libs Cheers |
Will have it ready by tomorrow morning (my time! GMT+9:30). Just got sidetracked with the other fixes. Will also resubmit the tree columns removal PR, I'm pretty certain the frozen grids were failing tests last time because of unrelated bugs. the TreeColumn removal should have zero impact, other than losing about 200 lines of unused code. |
This has now been superseded by #765 |
Have been progressing the addition of a column
hidden
property, rather than having to reassign using.setColumns()
whenever visibility changes. It's turning out to be relatively simple.There is a new example
example-column-hidden.html
.@ghiscoding I kown you're going to say 'wait until after the remove jQuery PR'. Happy to do that, but I'm setting up a PR so I can see what the tests are doing. Should be relatively easy to refactor this PR once jQuery is gone.
The only real sticking point at the moment is in the gridmenu plugin, which does some hanky panky to get around hidden columns. This may no longer be necessary. Just not quite sure which way you'd prefer to jump.