Does anybody know how to get image data from inside custom report item?
I want to enable users of my component to set image (background image for example) for the component to use. I've managed to create property with ImageSource type, but I reason that I need to read Source and Value, and than retrive the image data itself(since there is nothing in the ImageSource interface to access it).
I suspect that there should be a common interface for all types of sources, but if I need to use something like EmbeddedImageCollection that is also fine.
Thanks!
in Short : View Code and copy and paste the tag into the embedded images tag
Related
Good afternoon everybody.
Let me better explain the situation.
In a myComp.html I got the instance of some dropdown-buttons from another component <app-myButtonsFromAnotherComponent></app-myButtonsFromAnotherComponent>.
The dropdown-buttons are being displayed correctly BUT when I try to get the script which they are originally connected myButtonsFromAnotherComponent.ts they do not seem to communicate at all with it (I am using a Getter function in the .ts but it doesn't retrieve the datas) and at the same time, because of the instance, I cannot access their values from myComp.html either, I can just display the buttons on the screen and display the values through {{theValueInQuestion}} int their original HTML file.
Can anyone, please, help me to get those values and use them in my script?
PS Why "reusable" in the title? Because in such a way I can keep those buttons in a separate component and let other components grab them without copy and paste a ton of code.
They are two separate components you need a way to communicate between components.
you can look more into :
Localstorage
Output() and EventEmitter
Parent to Child via Input
In my application I have some modules which should have the possibility to upload images.
I created a child component for handling the image uploading, for easy reuse.
The problem is when I upload image from one of the child components it is always displayed in the first component instance.
I have replicated the issue here:
https://stackblitz.com/edit/angular-ivy-6ug9f6
Anyone knows what the problem is?
Both of your file inputs have the same id, so when you click the second label, it refers back to the first input. Try generating a dynamic id for each input and that should do the trick.
Consider the given scenario.
I have a class with properties that has all the necessary information regarding a page design. For example I know the line spacings, page number format, text to be displayed, text stye and margin etc.
I want to visualize the exact same page and display it on my Angular SPA. I also want to be able to edit the page layout using text editing tools (just like we have in ant text editing software). For example changing the text color, margins, text size etc and reflect it back to original class instance (two way binding to original object to be precise).
I want to know, Do we have any tool or package that serves the given purpose. If not how we can achieve this requirement in a simple yet effective manner.
Maybe you want to create your class as a component let us say contentComponent in which your class is attached to an HTML file , the HTML file should rely only on data binding and class binding to show content and set the layout of the page , in the other hand create another component editComponent that will get access to contentComponentclass properties through a service to set and change its properties and hence reflecting on the contentComponent view .
I'm looking for a way to create a reusable HTML widget for a website run on Sitecore 8. My original idea was to create a data template that basically consisted of a single Rich Textbox. The idea is that you could drop any number of instances of these widgets on a placeholder and it would render out the HTML from each instance of the widget on the page and in the correct placeholder.
Example:
A content item called /products/my-product is based off of "Product" data template
It consists of some fields on the Product template (maybe product name, price)
I'd like the ability for the content editor to quickly drop one or more instances of the HTML widget on the page (say, in the right rail or in a different placeholder on the sublayout. I know I could just throw a "notes" field on the product template, but I'd like to make it more dynamic so that they can add several instances of this HTML widget and place them anywhere they desire.
I quickly realized that because we need the ability for multiple instances of this widget, a data template was not enough because each instance of the widget would needs its own data to populate on the front. Thus, my idea was to allow the content editor to add HTML widgets as a child of the current item (so each item would have its own instance data). I don't think this will work because I don't know of a way to have these children tell the parent page which placeholder to put them in, so laying them out is a problem.
I also thought about somehow setting the placeholder name as a parameter or field on the data template for the HTML widget, but I couldn't figure out how to get Sitecore to dynamically add them to a placeholder when it glues everything together.
Is there a way to achieve what I'm trying to do? Seems like a reusable HTML (or other kind of widget, for that matter) would be a fairly common need. I feel like there's an easy Sitecore way to handle this that I'm missing and overcomplicating the solution.
From what I understand, you're looking for Datasource field of a component.
Basically you:
Create a data template which contains fields necessary for your component
Create a set of items using that templates
Allow authors to select one of them as the Datasource for your component.
It's built in Sitecore functionality.
Check blog post http://firebreaksice.com/using-the-datasource-field-with-sitecore-sublayouts/ or google for Sitecore datasource.
Other links:
http://www.nonlinearcreations.com/Digital/how-we-think/articles/2014/03/4-patterns-Sitecore-component-development.aspx
http://www.nonlinearcreations.com/Digital/how-we-think/articles/2015/04/Sitecore-templates.aspx
EDIT:
Read about Datasource Location field (defining the repository of datasources location) here: http://www.sitecore.net/learn/blogs/technical-blogs/getting-to-know-sitecore/posts/2011/01/handling-presentation-component-settings.aspx
Read about Datasources and MVC here: http://jockstothecore.com/sitecore-mvc-item-maze/
Using the Report designer in Visual Studio, I dragged and dropped a an Image control over onto the header but I'm lost as to what to do next. I need to choose the Source which gives me a choice between External, Embedded, Database and custom expression. I also have a Value property but it didn't prompt me to choose a file.
Any ideas?
On your Report Data view box (Where the report parameters, datasets etc) are shown, there is also a folder for Images.
Right click that and add the image you want.
Now when you use your image control you can choose Embedded and drop down any of the imagess included in the Images folder.
The External source is good for adding in a URL to the image and database is when the image is stored in one of your datasets.
Here is the solution if the report data view screen is missing
I found a way to do this:
If I open the report and give the focus to the report form (not one of the controls), I get a new menu item called Report at the top of Visual Studio. Open the Embedded Images... dialog and I can add a new image there. Then close that dialog and give focus to the image control that I want to have the static image. I can set its value property to one of the embedded images that I have added using the Embedded Images dialog.