-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Enhancement: Add maxWidth-Property to colModel-options #1019
Comments
Hello Robert, Thank you for question. You can't achieve this with css. All the column widths are calculated with javascript. We can easy add a maxResizeWidth option, but I think this will not do the job for you since it is related only when the user resize the column. I will think what I can do. You should know that in this case ( "columns should be adjusted automatically,") the option shrinkToFit should be set to false. Maybe you can look at column option autosize too . Will replay in the next week what we can/can't do. Best Regards, |
Hello Robert, Have a question - What you understand under automatic adjustment of the column width? Best Regards, |
Hello Tony, many thanks for the support. I often have the following requirement: The grid basically consists of three types of columns:
Let's assume the following ColModel:
Desired results assuming a window width of 1000px:
Desired results assuming a window width of 200px:
The following applies: I hope this makes it somewhat clear Thank you, |
Hello, Thank you very much for the detailed explanation. Now it is clear. Regards |
Hello Tony, No problem - I would like to thank you for the outstanding support. In the particular scenario in my company, it would be sufficient if the calculation was done when the grid was initially loaded and persisted for subsequent actions like scrolling, sorting, etc. Other users may have further requirements in this regard, and maybe a recalculation-method that the programmer could call up if necessary would be useful. Have a nice day |
Hello Robert, I'm going to implement this feature, but have some difficulties to implement it.
Let suppose that we have a grid with 4 columns, shrinkToFit = true and one column is set to have maxWidth.
IMHO leaving the gap between the grid box and table is recommended, because of the complexity of the procedure, but in this case we will have grid not looked as expected. What is your opinion? Best Regards, |
Hello Tony, In the case described, as a user I would expect the second option mentioned (recalculation of the columns).
Since the jqGrid is primarily aimed at software developers and less at the end user, in my personal opinion the first alternative is completely sufficient. Thank you |
Hello Robert, Thank you for the response. I will try with option 1 and see what will bring this. Hope to have final answer ASAP. Thank you again. Best Regards, |
Hello Robert, I have added the maxWidth option in colModel. You can test it. Of course this is working code and needs to be refined. Please let me know if it is ok for you. Best Regards, |
Hi Tony, Thank you |
Which CSS framework is used (jQueryUI, Bootstrap3 or 4 or 5 )? Can I have the settings related to it? What is the value width grid parameter in the options? |
Hello Robert, Thank you for the partial test case. I have play with it and found some other problems. Having this I will try to fix the calculation. Best Regards |
Hello Robert, Shortly with your setup maxWidth will never be set since you do not set default width in colModel. If this parameter is not set jqGrid set it to 150 by default. To overcome such situation I have added defaultColWidth parameter in grid options, which default value is 150. I have also fixed some other calculation problems and logic and hope that the script now will do this better. We are close to the final things. In the future it will be better if you put a working code which demonstrates the problem. The fix is in GitHub. Please let us know if you have any other problems with this. Best Regards, |
Hi Tony - It's me again. I think I found the problem with the maxWidth attribute. I'm now unsure about the gap in the grid. I saw on the screenshots in the documentation that this space is really reserved for a scrollbar. However. The behavior was different in version 5.5.4: A reduced window increases the number of pages from 18 to 26 Reducing the amount of data by filtering reduces the pages. In no case did a vertical scrollbar appear under 5.5.4 Have I forgotten to set a corresponding property or overlooked something? Thank you, |
Hello Robert, The vertical scrollbar depend on the height setting and shrinkToFit option. The example you provide is exception (which we should maybe fix). The situation is that the number of records Best Regards, |
Hello Tony, I've done some tests over the past few days. Unfortunately, we are about to release our institute software extensively, so the switch to 5.7 seems too tricky for the moment. So I'll have to defer that for now - also the maxWidth property topic - but will get back to that as time permits. Thank you in the meantime for your support. |
Hi Tony.
I would like to have an option to set the maximum width of a column.
I often have the requirement that the width of one or more columns should be adjusted automatically, but must not be larger than a defined value.
I've already tried to achieve this via the max-width CSS option that I set for all affected td elements, but failed. Apparently this attribute is not included in the column width calculation done by jqGrid.
Would such an option be possible - or is there a way to achieve the desired result that I haven't thought of yet?
Thank you in advance,
Robert
The text was updated successfully, but these errors were encountered: