I'm using an Object Page Layout in my SAPUI5 application and trying to bind an image through an OData url like this
/sap/opu/odata/CUSTOM/MY_SRV/ImageSet(1)/$value
And in the layout I try to bind the value like below
<uxap:ObjectPageHeader id="headerForTest" objectTitle="Object Page" showTitleSelector="false"
titleSelectorPress="handleTitleSelectorPress" showMarkers="false" markFavorite="false" markLocked="false" markFlagged="false"
markLockedPress="handleMarkLockedPress" objectImageShape="Square" objectImageURI="/sap/opu/odata/CUSTOM/MY_SRV/ImageSet(1)/$value">
But when I run the application the image not showing in the header area. The URL is correct.
And If I use an Image element it works fine.
<Image src="/sap/opu/odata/CUSTOM/MY_SRV/ImageSet(1)/$value" width="75px" height="75px" />
How to bind the Image to the Object Page Header?
Set the Property isObjectIconAlwaysVisible = true.
<uxap:ObjectPageHeader id="headerForTest" objectTitle="Object Page" showTitleSelector="false"
titleSelectorPress="handleTitleSelectorPress" showMarkers="false" markFavorite="false" markLocked="false" markFlagged="false"
markLockedPress="handleMarkLockedPress" objectImageShape="Square" objectImageURI="/sap/opu/odata/CUSTOM/MY_SRV/ImageSet(1)/$value" isObjectIconAlwaysVisible="true">
Related
I am new to asp.net MVC. I have the image source in database with the following:
#Model.Image2Url = "C:\Users\vasamad\Documents\VisualStudio2015\Projects\ReactMVC\ReactMVC\Content\Images\Products\3.jpg"
I am adding it to view like this
<img src="#Model.Image2Url" alt="No Image"/>
in browser inspect Element "Could Not load the image"
when I copy this URL and past in new tab its showing the image.
You should store a relative image path to your MVC application root:
~/Content/Images/Products/3.jpg
If you want full image paths then you will need to write a controller action that will read this image from the absolute path and stream it to the response. Finally the <img> tag will need to point to this new controller action. Here's an example:
public ActionResult MyImage()
{
// Get this from your database
string absoluteImagePath = "C:\\Users\\vasamad\\Documents\\VisualStudio2015\\Projects\\ReactMVC\\ReactMVC\\Content\\Images\\Products\\3.jpg";
return File(absoluteImagePath, "image/jpeg");
}
and then in your view point the image tag to this action:
<img src="#Url.Action("MyImage", "MyController")" alt="" />
I have created a page based on the examples found in the Easygrid petclinic sample apps.
Everything is working fine except the formatter/unformat.
I have a field called 'key' with label 'date', I am trying to generate hyperlink based on this field. I notice that the generated page ignores this attribute.
I am sharing the controller and the gsp
Field key defined in controller as
columns {
key{ label 'Date' }
In the View
<div id="grid-container" style="max-height:100%;overflow:auto;">
<grid:grid id='jqgridinitial' name="daily">
<grid:set width="2000" height="450">
<grid:set col="key" label="Date" formatter='f:customWikiFormat' unformat="f:wikiUnFormat"/>
The generated page is ignoring the formatter
{"searchoptions":{"clearSearch":false},"editable":false,"name":"key","search":null,"sortable":true,"label":"Date"
},
I also referred this solution by the creator of the plugin
Please let me know, if any additional details are required
You got the syntax a little wrong. Basically the parent tag is grid:grid and inside it you can set different properties ( by using grid:set ).
If you don't specify a 'col' then those properties will be set on the actual grid.
<grid:grid id='jqgridinitial' name="daily">
<grid:set width="2000" height="450"/>
<grid:set col="key" label="Date" width="100" formatter='f:customWikiFormat' unformat="f:wikiUnFormat"/>
</grid:grid>
For UI markup, I use UIBinder. In a specific area, I want to place the logo and then dynamically change it:
<ui:UiBinder
xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:g='urn:import:com.google.gwt.user.client.ui' >
<ui:with
field='res'
type='com.myproject.client.resources.Resources' />
<g:Image resource='{res.offline}'/>
ClientBundle:
public interface Resources extends ClientBundle {
#Source("offline.png")
public ImageResource offline();
#Source("online.png")
public ImageResource online();
// ... and so on
}
When a user starts a session, his logo changes.
How to change the image that declared in the UI markup?
The solution may be as follows.
Add the UI:field attribute in the markup:
<g:Image url='{res.user1.getURL}' ui:field="imageUser1" />
Then, change the attribute value by this way:
#UiField Image imageUser1;
imageUser1.setVisible(true/ false);
It is also possible dynamically change the image URL -
user1.setUrl(offlineImg.getUrl());
See also:
Path for images folder in GWT project
Scaling an Image in GWT
How to change the url of a g:image in gwt
So the title pretty much says it all.
I am using Orchard CMS v1.7. I have created my own content type (Product Categories) - this is essentially the same as a page though also has an extra field (Media Library Picker Field) to allow me to select and display a single image - this will be displayed on both the list item view and also the main page content.
I use a projection page to display all content types "ProductCategories". This works well and as expected.
I now want to display this additional image within each of the items in the list of ProductCategories when viewing the projection page.
Using Shape Tracing I created an alternate for my list items.
By default, this looks like this:
#using Orchard.Utility.Extensions;
#{
if (Model.Title != null) {
Layout.Title = Model.Title;
}
Model.Classes.Add("content-item");
var contentTypeClassName = ((string)Model.ContentItem.ContentType).HtmlClassify();
Model.Classes.Add(contentTypeClassName);
var tag = Tag(Model, "article");
}
#tag.StartElement
<header>
#Display(Model.Header)
#if (Model.Meta != null) {
<div class="metadata">
#Display(Model.Meta)
</div>
}
</header>
#Display(Model.Content)
#if(Model.Footer != null) {
<footer>
#Display(Model.Footer)
</footer>
}
#tag.EndElement
I am now stuck - I have no idea how I display the image that is associated to this item.
I step through my code to inspect the content of the Model passed into my custom list item view and something strange happens...
when the model is loaded in there is no ListLogo inside. - see first snapshot..
However, the moment i step through #if (Model.Meta != null) my ListLogo can now be found on the object, however it's still empty - as in this snapshot.
How do I display the image associated to this content item - there is only 1 too.
Do I need to override creation of the actual list itself? If so, can you give me pointers?
Thanks in advance.
bah - so once again this all comes down to the Placement.info file in my theme.
I added a reference to the Fields_MediaLibraryPicker inside my DisplayType="Summary" and it worked like a charm.
E.G My placement.info in my theme has this for an item in my list
<Match DisplayType="Summary">
<Place Parts_Common_Metadata_Summary="-"/>
<Place Parts_Title="-"/>
<Place Fields_MediaLibraryPicker="Content:1" /> <!-- this adds the field.. -->
</Match>
I'm writing a bookmarklet which needs to work in the context of pages whose design I don't control. Some of the pages I need the bookmarklet to function in use frames (in framesets). Is it possible for a jQuery-UI dialog to work inside a frame?
Currently, when I encounter a page with a frameset, I creating my dialog like this:
var frame = window.frames[0];
var div = $(frame.document.createElement("div"));
div.html("My popup contents");
div.dialog( ... );
The result is that jQuery appends the ui-widget div to the main document, rather than the frame's document. Since the main document is just a frameset, nothing is displayed. I can't find any options in the jquery-ui API to specify which document the widgets should be constructed in. The bookmarklet will necessarily be running (or at least starting) from within the context of the outer document.
I'm aware that it won't be possible to display an overlay over the frames; I'm comfortable with display just in a single frame. Also, some other notable bookmarklets fail to function on pages with framesets, so this may be a common problem.
Suggestions?
Bookmarklets typically don't use jQuery. Most bookmarklets open a window which has jQuery.
Here's what I ended up doing: rather than attempting to display within or over a frame, I just had the bookmarklet rewrite the page to remove the framesets and add my own body and content to the page. This allows the bookmarklet to still introspect the frames and get data that it needs from them to construct the overlay prior to removing the framesets, but allows the overlay to still work.
Something like this:
if (window.frames) {
for (var i = 0; i < window.frames.length; i++) {
// ... grab data from the frame ...
}
}
if ($("frameset")) {
$("html").children("frameset").remove();
document.body = document.createElement("body");
$("html").append(document.body);
// ... add my stuff to body ...
}