How to test jspdf autotable empty cells? - jspdf-autotable

I'm trying to make a PDF version of crossword puzzles. Is there a way to test cells content ( cells with empty strings or cells with just nothing ) in order to paint them black?

You can use the createdCell hook to dynamically change styles of cells depending on there content.

Related

Vaadin Grid: setAutoWidth(true) with recalculateColumnWidths() works only for visible rows in the grid

After I setup the a Grid with all the columns with setAutoWidth(true) and I execute grid.recalculateColumnWidths() this will auto-adapt the columns width with the content of the columns but only for the rows that are visible in the grid.
What happen is that scrolling rows in the grid I can find some cells with content larger than the content on the first visible rows and they were not auto-adapted and so the content is truncated (es FOO...)
Considering that I am using ListDataProvider, so all the rows are loaded into memory when I build the grid, why it is not calculating the right width for every column considering all the rows?
Is this a normal behaviour? It is possible to change it to consider all the rows when it is calculating the columns width?
I am using Vaadin version 14.
Thanks for the help
Yes,
this is the normal behaviour of the vaadin grid and is (at least for the 23.x) documented that way
https://vaadin.com/api/platform/23.2.6/com/vaadin/flow/component/grid/Grid.Column.html#setAutoWidth(boolean)
The relevant part, why it's not looking at all items in the grid is here:
For performance reasons the column width is calculated automatically only once when the grid items are rendered for the first time and the calculation only considers the rows which are currently rendered in DOM (a bit more than what is currently visible). If the grid is scrolled, or the cell content changes, the column width might not match the contents anymore.
You can however "retrigger" a width calculation
You can manually trigger the auto sizing behavior again by calling Grid.recalculateColumnWidths().

How to style individual cell text in jspdf

I'm using jsPDF to build a simple information table but I need some cells to be italic or bold.
I was wondering if it's even possible to style them or should I just draw rectangles around the text and simply put regular text modules inside it.
I'm not usign AutoTable. This is simply the regular table.
http://raw.githack.com/MrRio/jsPDF/master/docs/module-cell.html
The only option I see is using the table func and setting the fontSize config there, but there's no option for font style and setting doc.setFont('Roboto', 'bold') doesn't affect the table.

iOS Swift trouble making detail page with embedded list and collection view

I am new in iOS development and Swift, I'm struggling creating a relatively simple detail page.
For now I have this layout made with interface builder:
The parts highlighted in red must have variable heights, every element is inside one big stack view which is inside a big scroll view.
The list of phone numbers is a label with Lines set at 0 so if I understood correctly that element will size itself correctly with the content.
I don't know how to implement the other two lists and how to make the whole layout to wrap onto the content.
To make you understand better I'm struggling because I'm used to make layouts in android and so making extensive use of the wrap_content option.
Thanks in advance
I think, you could use UITableView for image+text list and UICollectionView for images. If you are using constraints you have to add height constraints to your tableView and collectionView, but you could update those constraints from code with real heights.

How to display a couple pages of text in swift ios

I've got an information page which has about 3 pages worth of text to display.
What would be the best method to display all this text in an iOS application coded in swift?
I have been trying to do it with scroll view but I can't fit all the text into one label on one screen. And all the tutorials I'm following say to set the scroll view to the size of the label. But the thing is my text is so long that it would fill the screen several times.
How could this be accomplished so that no matter which device size screen it's being viewed on it will fit all my text and be scrollable vertically?
I can't seem to get it working with a scrollview :/
Put the content in an HTML file, and render it using WKWebView: https://developer.apple.com/library/ios/documentation/WebKit/Reference/WKWebView_Ref/index.html#//apple_ref/occ/cl/WKWebView
You can make a text view non editable.
I have this problem also.. Maybe you could use table view and add contents programmatically.. hope it could add to your imagination.

RichText label or 'flow' layout for text in iOS (Xamarin/MonoTouch)

I am trying to repduce a similar sort of layout as in the screenshot below from the Digg app..
Notice that each list entry has a title in bold followed by the source, posted time and finally if there is enough space the start of the description line.
The question is what is the best way to achieve this in iOS? With some posts having longer titles than others I cannot simply say that the title label is 40px high and then place the Source label at 45 as the title will sometimes be longer and sometimes shorter.
Do I have to calculate the height of the label based on its contents before arranging the layout or is there some better way of doing this in iOS so that the views 'below' are automatically moved down?
Another alternative would be some sort of rich text label that I could add all the text to and have it automatically wrap round moving the later text down but I cannot find any sort of control in standard iOS / Xamarin (MonoTouch).
Any pointers would be greatly appreciated?
If you are using a storyboard the simplest way to achieve this result is to define different prototype cells. For example, you could define four different prototype cells, each one with a different layout like those shown in the example picture you provided. You can dequeue the appropriate cell based on the content you want to display so there is no need to adjust the layout in the code.
If you are doing everything in code, it's a lot more complicated since you have to build your own "layout engine" to adjust size and position of the views in your cell. You can have a look at XibFree or use MonoTouch.Dialog as suggested in the comments.

Resources