-
Notifications
You must be signed in to change notification settings - Fork 822
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
[WIP] Adding options
to ColumnComponent#setWidth
#3964
base: master
Are you sure you want to change the base?
Conversation
options
to ColumnComponent#setWidthoptions
to ColumnComponent#setWidth
Hey @rathboma Happy to have this as additional functionality, in-line with how a lot of the other functions work, could we change this so that you just pass another value instead of true into the width property. A single word string of some kind that isnt a valid width would be easy to pick out from the value. just a bit simpler than adding a whole config object for a simple functionality tweak. Any thoughts on the word? Cheers Oli :) |
Hey, that sounds good. Maybe something like |
Perfect |
So looks like this is harder than I expected. So without persistence, Persistence causes some problems: See So in that case, there's no way to restore to |
Hey @rathboma I think this is actually becoming two different bodies of work, one to allow restoring column values to their initial width, and another that then updates the persistence module to add the functionality you need, as from your description i would consider the existing functionality of the persistence module correct. Looking at the content of the PR, i have a couple of points of feedback: widthFixedYou seem to have made changes to a couple of places where it is checking to see if the If you need to reset the with and allow the width to change, then your functionality should clear the persistenceIm a bit confused as to why all the extra logic has been added in the As for the persistence modules behaviour, i would consider the described behaviour correct as it is the initial width of the table on load. and while i can see in your usage case that isn't correct, when this is being used on a website i can see that as being the predominant way of managing things. What we may need to to add an extra callback to the persistance module that lets you intercept the persisted data before it is loaded into the columns so that you can add any additional custom functionality If you need to have some custom behaviour at the point, i would suggest that you add a callback to the setColumnCallback function of the persistence module, that lets you intercept the column data before it is loaded into the table and make any changes that you need to it there for your custom usage case. If you need to be able to reset the "initial" state of the column after this then can i suggest a function on the column component to help with this. I know this sounds like a few extra steps, but it will make for an update that is more rounded and can be applied to a lot more different usage cases and in a much more flexible way. Cheers Oli :) |
Hey Oli, So the code in this PR wasn't ever really designed to be merged, I mostly just ended up exploring the problems and seeing if I could 'hack' a fix in. Here's what I think I need to do, let me know if this works: PR 1 -
|
@olifolkerd here's another idea that solves both problems: Instead of all that, what about this change to setWidth({ maxWidth: 123 })So instead of passing int/bool, also accept an object with a maxWidth. This does EXACTLY the same as This allows a user (me) to pass the same value I previously used for Thoughts? This seems simpler |
Hey @rathboma Good idea, that does sound like a simpler proposition. Im not keen on passing in the params object, it is not a standard part of the Tabulator API, pretty much all functions take in simple values, and i want to try and keep the API as consistent as possible. How about we update the Sound like a good compromise? Cheers Oli :) |
Perfect |
This adds the ability to override
force
when callingsetWidth(true)
Why?
setting force to false allows Tabulator to take
maxInitialWidth
into account, like when it lays out a column for the first time.Usage