Display long text in UI-GRID column without ellipse - angular-ui-grid

In my application, I'm using ui-grid to display two column: name and description.
Description column can have around 500char. Currently ui-grid is trimming the description text using "ellipse". I want whole description should be displayed in a single line. I dont mind if horizontal scrollbar come. How to do this?

You can add the "width" parameter in your columnDefs.
$scope.myGrid.columnDefs = [
{ name:'name', width: 100},
{ name:'description', width: 1000}
];
http://ui-grid.info/docs/#/api/ui.grid.class:GridOptions.columnDef#properties_width
EDIT : You can try adding up the "width: '*'" option. I know it didn't work for me, on my side, but I am not using the most up-to-date version of UI-Grid, so it might only work on a more recent version than the one I use.

Related

How to draw a rectangle in a column in jsPDF autotable?

I am using Quasar and Electron and producing PDFs with jsPDF and also using autotable. Love it so far, gives me a lot of control.
I need to place a box inside a cell/row. I can get a box to appear on the PDF but sticking it into the needed cell is eluding me. I've been googling and don't really understand all the details.
As you can see the little black box is on the top left, and I need a box inside each column where I've drawn the little red boxes.
does the data.row.index correspond to the 0 columns? It needs to skip the first few rows that are just rowSpan for the title areas. I do not have column keys defined... is that necessary? I've been looking at the autotable examples and trying to understand the details but the documentation isn't as elaborate as needed by a newbie such as myself.
My data is pulled from an array that's built from a database.
I will continue to Google and see if I can figure it out but would love help. Thanks.
this.doc.autoTable({
head: headers,
body: this.tableRows,
theme: 'plain',
didDrawCell: (data) => {
if (data.row.index === 0 && data.row.section === 'body') {
this.doc.rect(20, 20, 3, 3, 'F') // empty square
}
}
})

Prawn - Rails 5.2 Put two bits of text on the same line but at either side

I've been trying to replicate the text style in the following example:
But I havn't been able to find a way to put two text elements on the same line.
Is this possible with Prawn? If so how does one do it?
You can use prawn-table, your image looks like a table with 2 columns.
https://github.com/prawnpdf/prawn-table
table([
["Base Price", "$275,99],
["Canary Cozy Sound Isolation Blankey", "$11.00"]
])
You will have to play, of course, with the style of the table to remove borders, the alignment of the cells for the second column, etc.

Kendo Chart Column Multi-Line Labels

I recently inherited a project that makes extensive use of Kendo charts, with a request to add some information to column labels. The labels currently contain an integer and a percentage, and the revision would add an additional percentage value. Since the labels are getting a little long, they need to be split across multiple lines.
So a column label that currently reads:
3, 0.00%
would now read
3
0.00%
9.99%
The code is arranged MVC style, so the code determining each label looks similar to the following:
.Labels(labels => labels.Visible(true).Position(ChartBarLabelsPosition.OutsideEnd)
.Template("#= value #, #= kendo.format('{0:P}', dataItem.GetPercent)#"))
.Tooltip(t => t.Template("#=series.name#: #= value #, #= kendo.format('{0:P}', dataItem.GetPercent)#").Visible(true));
It seems like this should be a simple thing, but I can't find the syntax for properly working line breaks into the labels. Kendo does seem to attempt to interpret <br /> entries, but these disrupt the flow of the chart and cause all following label values to be displayed below the entire chart rather than in place just above the column. Some forum posts I have searched assert that this is not currently possible in Kendo, but also mention that it 'will be possible in 2014' (most of these are older posts though, and since I don't know much about kendo, I could be misunderstanding which labels they are referring to).
Can anyone provide me with the proper syntax for inserting a line break into this type of label (from code) or a possible workaround if the functionality is not currently supported?
Thank you!
UPDATE
I have found the <tspan> workaround, which does help a little but still looks pretty bad since my charts are resized dynamically with the page (so, for a stacked bar chart, the widths and starting positions of each column are not static). The <tspan> tag respects the y coordinate of each label but not its x coordinate, so that has to be set individually for each column; if left unset, the labels for all columns will appear at the leftmost side of the chart where the y axis values are. Since the charts are dynamic, there is no "correct" static value to put there and I have been unable to find a way to fetch a column's starting position from within the template code. Is there any way to correct this such that the <tspan> workaround becomes a viable option?
(Workaround found here)
From 2014-Q2 versions, Telerik / KendoUI finaly implemented the \n
See the documentation:
The text can be split into multiple lines by using line feed characters ("\n").
http://docs.telerik.com/kendo-ui/api/javascript/dataviz/ui/chart#configuration-categoryAxis.title.text

rails gem prawn, image and anchor

Can you tell me how to insert image which will be a link to for example page 20? I know how to make with normal text:
text "<link anchor='page20'>Go to page 20</link>", :inline_format=>true
and then on page 20 I have
add_dest('page20', dest_fit(page.dictionary))
but how to do this with image ?
Partly thanks to lightswitch05 for some prodding in the right direction, I've found a way to get the effect I want through this inelegant way:
Insert an image in a bounding_box (the page cursor is at this point at the bottom of the image)
Move the cursor back up to the top of the image
Insert a text link over the image (in my case I just used however many vertical bars '|' were needed to cover the image)
Confirm visually that the clickable link area is about the same as the boundaries of the image
Make the text link transparent, and voilĂ , it looks like you're clicking the image.
Here's some example code (measurements not exact; there was a lot of tweaking involved):
bounding_box([0, cursor], width: 35) do
image open("http://mysite.com/remote_image.jpg"),
fit: [35, 35],
align: :center
move_up 35
transparent(0) do
formatted_text([{
text: "|||", # placeholder
size: 40,
link: "http://example.com/"
}], align: :center)
end
# stroke_bounds
end
Needless to say, this experience has got me looking a bit more at Wicked PDF in order to do what I think I want to do with PDFs.
I'm sure a better/more elegant solution exists, so I'm not planning on considering this my final answer.
Prawn does not support this functionality. In fact, even if you placed a formatted_text_box over an image and fill it with white space, it still will not work. An anchor has to include text to work. If you don't mind having text over your image, then that might be a solution.
Prawn's own readme states:
One thing Prawn is not, and will never be, is an HTML to PDF generator.
After dealing with many of Prawn's shortcomings, I've switched to using wicked_pdf for my Ruby on Rails PDF generation and have been very happy with it. If you can do it in html & css, it can be done with wicked_pdf.

Why is TListView's Node text truncated with an ellipsis until I toggle ViewStyle?

Can anyone help me understand why the displayed labels for a TListView are truncated with an ellipsis at program startup, but are completely displayed after switching to vsIcon and back
again? I don't want any truncation or ellipse...
Edit 1: Columns[0].AutoSize is TRUE, MaxWidth is 50, Width is 50.
Edit 2: Left hand screen capture corrected so source text is the same as the right side's.
TIA
Assuming you are using ViewStyle=vsReport, make sure you have a column defined whose Width is large enough to accomodate your longest text value. TListColumn.AutoSize does not always work correctly, especially when the Listview is intially loaded.
Peter Below posted an answer on the Embarcadero forum (https://forums.embarcadero.com/thread.jspa?threadID=45670&tstart=0) pointing to an identical question asked a year ago here: https://forums.embarcadero.com/thread.jspa?threadID=27079.
Synopsis is to manually set the column width:
Uses CommCtrl;
ListView_SetColumnWidth( listview.handle, 0, NewWidthOfColumnInPixels );

Resources