Ag-Grid AutoColumnSizing not working for longer content - ag-grid

I'm using ag-grid ng2 v28.1, and some columns are autosizing, and some are not (using selective column autoresize based on ColId). On both Chrome and Edge. I dug into the autosize code, and something is preventing the dummy container from actually growing its contents based on the dummy row/cells cloned into it. I see the cells with their content but the measuring span doesn't seem to be expanding based on its contents. I have stripped out all my own styles and div layers from my cellRender, and it still doesn't work. I can't find any CSS reason why that span won't expand to consider it's contents.
Anyone ever hit up against this wall?

Related

Dynamically Resize Controlled TinyMCE React Component

Background: we have TinyMCE React inside a few contexts where the parent element is manually resized by the user (resizable modal dialog, etc.) and we want the TinyMCE component to resize appropriately. In older versions, we did this using the resizeTo functionality documented here. However, that no longer seems to be available after the upgrade.
My previous attempt to resolve this involved using a key based on concatenating the width and height of the editor with a debounce while it was resizing. Basically, whenever the size changed by enough, I tore down the old component and rendered a new one whose config options included the new size. While this is largely effective, it causes an issue where, when you attempt to edit the field after resizing, it flickers and loses focus initially.
Unfortunately, we are using pixel-based size calculations, so specifying the height in percentages instead of pixels won't work.
What is the new official way to do this? Ideally, there would be some new version of editor.theme.resizeTo that we could use instead and dispatch with the key-based solution entirely, but I was unable to find it in any of the documentation.
Just wrap the editor in a div which has the calculated height and width, and then set the editor to height and width of 100%.

TinyMCE 4.x resize event

I've been searching around (both on SO and around the web) to try to figure out how I can get the current height of the editor after the user has resized it. The TinyMCE 4.x docs don't show any kind of resizing event. When searching around I did come across the ResizeEditor event but that seems to apply only when objects within the editor are resized (which makes it seem like a poorly named event). Despite that, I tried to listen to the ResizeEditor event just to see and it does appear to fire whenever I resize the editor (though, I'm unsure if that's because the actual editor is resizing or because elements within the editor are getting resized, too. In any case, only the event object is passed in as an argument to the listener and I don't see any way to get the editor's current height (after the resize) from that event.
So, is there a way I can do this? To listen to the editor being resized and get its height?
thnx,
Christoph
You should be able to get the entire height of the editor (Menus, Toolbars, StatusBar, content area, etc) with code like this:
tinyMCE.activeEditor.getContainer().clientHeight
tinyMCE.activeEditor.getContainer().clientWidth
When you call tinyMCE.activeEditor.getContainer() you are getting the outermost div that contains all that makes up TinyMCE. From there it is just standard JavaScript to get the relevant dimensions of that element.
Here is an example: http://fiddle.tinymce.com/qigaab/18

Angular UI Bootstrap typeahead does not extend past parent div border like a normal select dropdown

I'm using the Angular UI Bootstrap typeahead to display a customized list of suggestions as the user types into a text input form control. This form control exists inside a div using jQuery slimScroll in order to maintain a constant div size despite the size of its contents fluctuating. I really hoped the typeahead would display over everything like a regular html select dropdown, but unfortunately it does not, as can be seen in this plunker. I've tried futzing around with the z-index and adjusting the position and display properties; all fruitless endeavors.
Does anybody know how to get the typeahead popup to display over its parent border? If not, is there a way I could coerce the select tag to display HTML content so I can include glyphicons, emphasized text, etc. in the list of suggestions?
The problem is with the slim scroll - you are inside a div with relative position and overflow hidden (think of it as an iFrame). There is a small workaround...
You could, essentially set the position of the generated UL (.dropdown-menu) to fixed, set a height for it, then set an overflow:scroll...
It would work in some scenarios where the input field has a fixed position... otherwise you'd need to control where the input is and adjust the position of the auto-complete to follow, and a whole other bunch of nasty scripts.
Without looking at your application, I cannot understand why your have this particular architecture, but I can say that there must be cleaner options for handling autocomplete outside of slimscroll.
I just set typeahead-append-to-body="true" on the typeahead control and it worked. Not sure exactly why, but it's certainly a simple solution.

CodeMirror: auto-resize horizontally, without scrollbar

I need a CodeMirror editor which starts with a certain width and then grows automatically to the right to match the maximum line length. I.e. roughly what CodeMirror does when height is set to auto, but with width.
Here's a self-contained example. The editor grows automatically along the y-axis fine, but not along the x-axis. By tweaking the CSS, I can either have a fixed width editor with a scrollbar, or one which fills the entire width of the browser, but not one which grows as you type. I assume overflow-x is relevant, but I don't understand how it interacts with other CSS size properties set on parent elements. I also tried setting that property on CodeMirror-scroll, but it didn't help.
I believe this can be done using CSS properties alone. In fact I have this behaviour in my application already, but growing to the left, rather than the right, but I don't understand why it happens, or how to reproduce it in a small example.
This question is essentially the same, but for the vertical scrollbar.
Simply add float:left to the CodeMirror div.
<div id="here" style="float:left"></div>
This is not something CodeMirror supports. You may be able to get something working by setting .CodeMirror's width to (-webkit-)fit-content, but there will likely be corner cases where this breaks the scrollbars or cursor placement.

Widget widths: 50% + 50% > 100%?

I am using Google Apps Script and the Apps Script UI Builder, which is based on GWT widgets.
If I create a Flow Panel, and add two Labels of 50% width, then these labels appear on separate lines. But isn't 50% + 50% = 100%.
How do I make them appear on the same line?
To try it out yourself:
Open a Google Spreadsheet.
In the Spreadsheet menu, click: Tools / Script Editor...
In the Script Editor menu, click: File / Build a user interface...
Add the widgets to the canvas.
Of course this question doesn't just apply to the problem with the labels. In general I am totally puzzled concerning how to build flowing layouts with the UI Builder. There seem to be (hidden?) paddings and margins that make things very hard.
It's all based on CSS and its box model, and that issue has accumulates cruft over the last 15 years or so. In essence, the widths you specify don't take into account margings (and/or possibly padding, it's been a while), so you will need to add a stylesheed that minimizes them. See something like this CSS reset.
Labels translate to <div>s, which appear on different lines by default. You could try adding float: left to the labels, or change the display mode, etc.
You could also try InlineLabels, which I think compile to <span>s.
If you've already tried all this, then your Labels are apparently just too wide. It's annoying that two 50% objects wouldn't fit on the same line, but what isn't annoying about working with HTML and CSS?
The solution is simple. For both labels, set to zero:
Borders and Margins / Margin
Don't know why I didn't see that yesterday - I was doing a night shift... ;-)