How to display an image inside an ng-grid - angularjs

I'm using ng-grid to create a table in which one of the columns is an image column. Each image cell will get it's image from ng-src. At the end of the URL, there will be a specific identifier. Here is the part of the directive for the cell template that sets the text of the image. The 'image caption' is not appearing. Just getting row.getProperty('imageCaption').
attrs.$set('ngSrc',
"http://dummyimage.com/60x40/FFF/000&text=row.getProperty('imageCaption')");
Here is the plunkr

I don't think you should need a directive here, you can set your ng-src inside your imagetemplate.html, like so:
<img ng-src="http://dummyimage.com/60x40/FFF/000&text={{row.getProperty('imageCaption')}}" lazy-src >
Here is revised plnkr:
http://plnkr.co/edit/Bh1LKHRUXHpJa4KEUtA7?p=preview

Related

Create clickable URL in Hue

I want to create a clickable URL in hue as shown in below image :
I found it in a blog :
https://blog.cloudera.com/blog/2016/05/how-to-process-and-index-medical-images-with-apache-hadoop-and-apache-solr/
They have not explained how they did it.
Can anyone tell me how can it be done in hue?
To summarize the video,
Drag the HTML results panel onto the dashboard, go to the HTML tab of the Editor, add a field for
text you want to display
Where url is the field of the collection (the {{ }} marks are to be included to render the field)

How to display formatted html in text area in angularjs?

I am trying to display html by using angularjs sanitize module and ng-bind-html attribute on the element. It works fine if I have the attribute
on a div element.
<div ng-bind-html="htmlText" contenteditable="false"></div>
But I need the same text in a text area control. When I read about displaying html in text area, my understanding was that
text area does not support this. Is there a way I can convert the html to text before hand in controller and then use only ng-bind on text area? I have multiple long paragraphs and bullet points in html to display as formatted text.
Thanks for any suggestions.
//Does not display formatted html.
<textarea class="form-control" ng-bind-html="htmlText" contenteditable="false" rows="7"></textarea>
textarea only supports plain text. Since you are not allowing the text to be edited, I'd use the div that you started with. I suspect that you're trying to control the size and enable scroll bars when necessary on the div, and hoping to get that out of textarea. You'll be much better off just styling the div accordingly.

bootstrap-typeahead is not working in ng-grid

I'm working in a project, where I have to show a typeahead in a ng-grid cell. But, the typeahead is not working in a ng grid cell. I have put a Plunker.
See that the typeahead is working in the same page above the grid. But it's not working in the ng grid cell. Can you please help?
Thanks in advance.
Spent quite some time tracking all the problems in your plunker, there were quite a number of them:
you were missing ng-model directive on the input elements used in grid's cell, there were many errors in the console
typeahead window is appended as an element after an input element so it means that you need to have it wrapped in a parent DOM element, ex.: <div>
The 2 above changes made the typeahead work. Well - partially. The correct DOM structure is generated etc. but nothing gets displayed due to CSS conflicts. It seems like both typeahead popup and a cell in a grid are absolutely positioned. This is a bit surprising for a grid but OK. The real problem, though, is that the .ngCell class has the overflow: hidden; property and it makes the typeahead popup invisible.
If you remove the overflow: hidden; from the .ngCell it all starts to "work":
http://plnkr.co/edit/pzLb3079yuhDtW1XIxvq?p=preview
I guess we are facing conflicts of Bootstrap's CSS and ng-grid CSS. We can't change Bootstrap's CSS in this project so you will have to decide to either bring this issue to the attention of the ngGrid folks or hack one of the CSS definitions.
More info about how to make work ng-grid + typeahead inline editing:
http://lemoncode.net/2014/01/28/ng-grid-inline-editing-using-bootstrap-typeahead/
plunkr:
http://plnkr.co/edit/8udsvZSokG5v37xicyuz?p=info

ExtJS: Making an image as a column header

Is it possible in ExtJS 4.0 to set a column header as a image, or custom rendered HTML?
The API for column text says:
text : String
The header text to be used as innerHTML (html tags are
accepted) to display in the Grid.
Which means you can pass in something like <span class="mySpan"></span> and define a css class that has a background image.
EDIT:
Here is an example:
http://jsfiddle.net/HSVj8/102/

Using lightbox2 to display text instead of images

I am trying to use lightbox2 to display a block of text after clicking a heading element:
something like
<h3>name</h3>
I have used lightbox for images with captions but this time I would like the caption to come up without an associated image after clicking a name on a webpage.
Thanks for any replies.
I don't think that lightbox2 is made for such a thing, why don't you try http://fancybox.net/ this one works 100%.

Resources