I want to set the default value of the 'Vertical Alignment' to 'Top' property present in the Cell Properties dialogbox of the CKEditor in the hybris backoffice. Such that when the user open up the dailog box the value 'Top' get automatically pre-populated in the Vertical Alignment field. (added screenshot).
DialogBox
I'm using the below code: (This works for setting defaults for normal textbox fields. but not working for select dropdowns).
CKEDITOR.on('dialogDefinition', function(ev) {
var dialogName = ev.data.name;
var dialogDefinition = ev.data.definition;
if (dialogName === 'cellProperties') {
var infoTab = dialogDefinition.getContents('info');
var vAlign = infoTab.get('vAlign'); //attached the screenshot of the object that I get here.
vAlign.selectedIndex = 1;
infoTab.get('vAlign')['default'] = 'Top';
}
});
This is the image of the vAlign object select object that i extract from the defination :
vAlign object
I'm able to set the table properties like 'txtBorder', 'txtWidth'(which are texbox input) successfully, but not able to change the default in the dropdown.
Related
I'm automating a test of location selection. The options will be in the dropdown menu. There are three options(locations) in the dropdown menu. Depending on the location selected the data on the page will be changed accordingly. I'm trying to store the location in the properties and retrieve from it. The location in the properties file looks like:
location=UK
The code to retrieve the location property:
Properties prop = new Properties();
prop.load(f);
setLocation(prop.getProperty("location"));
When I try to print the location property, the correct value is getting displayed.
System.out.println(prop.getProperty("location")); //The value UK is displayed
The setLocation() method code is:
wait.until(ExpectedConditions.visibilityOf(selectLocation));
selectLocation.click(); //now the dropdown will be displayed
Actions action = new Actions(driver);
if(location == "UK") {
wait.until(ExpectedConditions.visibilityOf(ukLocation));
action.moveToElement(ukLocation).click().build().perform();
}
else if(location == "US") {
wait.until(ExpectedConditions.visibilityOf(usLocation));
action.moveToElement(usLocation).click().build().perform();
}else {
System.out.println("didn't get the location");
}
When I run the code
"didn't get the location"
is getting displayed.
I've implemented the properties for the URL and it worked. Here I can get the location property and display it on the console but the problem is occurring at the string comparison. The setLocation() method works if I pass string as the location like:
setLocation("UK");
Try using the .equals rather ==.
if(location.equals("UK")) {
I am creating a PDF form using adobe reader. I have added an image field and a text box. The text box is read-only and I want to populate the text box with the path of the image selected by the end-user, in the image field. Following is my code:
var one = this.getField("Image1");
var two = this.getField("Text1");
two.value='The Path';
The above code runs normally but I can't figure out as to what to write instead of 'The Path', to get the actual path of the image selected by the end-user.
P.S.
On the Image1 button there are 2 actions:
Mouse Up(execute Js)
event.target.buttonImportIcon();
On Blur(execute Js)
var one = this.getField("Image1");
var two = this.getField("Text1");
two.value='The Path';
If I am understanding your request correctly... Assuming that Image1 is a button field and Text1 is a text field and you want the selected image file to appear as the button icon, the code would be as follows...
var one = this.getField("Image1");
var two = this.getField("Text1");
var doc = app.browseForDoc(); // Allows the user to browse for a file
var docPath = doc.cPath; // gets the file path of the selected file
one.buttonImportIcon(docPath); // uses the selected path to import the image as the "normal" or "up" button icon
two.value = docPath; // set the value of the text field to the selected device independent path
I'm currently writing a site using Sitefinity CMS. Can someone please explain how to get the current dynamic content item from server side code on page_load?
I have written a user control to display a custom gallery of sliding images. There are multiple content types in my dynamic module. The user control will sit as part of the masterpage template rather than on every page. On each page load I would like to fetch the current dynamiccontent item that is associated with the page and examine whether it has a property with the name 'Gallery'. If so I would then extract the images and render them via the usercontrol.
Thanks,
Brian.
I'm assuming your images are related content. This gets every published content item of your type.
var dynamicModuleManager = DynamicModuleManager.GetManager();
var moduleType = TypeResolutionService.ResolveType("Telerik.Sitefinity.DynamicTypes.Model.YOURTYPEHERE");
var dcItems = dynamicModuleManager.GetDataItems(moduleType)
.Where(l => l.Status == ContentLifecycleStatus.Master);
foreach (var dcItem in dcItems)
{
//pass the dynamic content item to a model constructor or populate here, then
// get your image this way:
var image = dcItem.GetRelatedItems<Image>("Images").SingleOrDefault();
if (image != null)
{
ImageUrl = image.MediaUrl;
}
}
I want to add a value from a custom user attribute to the header of the cards in the default cardboard Kanban app. I added the following to the render function :
.....
var idDiv = document.createElement("div");
dojo.addClass(idDiv, "leftCardHeader");
header.appendChild(idDiv);
// MY NEW CODE
if(item.Domain && item.Domain.length > 0) {
var domainDiv = document.createElement("div");
domainDiv.appendChild(document.createTextNode(
" Domain: " + item.Domain));
header.appendChild(domainDiv);
}
// END MY NEW CODE
var ownerImg = document.createElement("img");
dojo.addClass(ownerImg, "cardOwner");
var ownerName = document.createElement("div");
dojo.addClass(ownerName, "cardOwnerName");
header.appendChild(ownerImg);
header.appendChild(ownerName);
....
This adds the text value to the card header but in doing so it pushes the owner name and image down a row in alignment. I have looked at the CSS but don't see any formating that is sting length dependent but I am still relatively new to this area. I tried changing the font size in the CSS but that didn't change anything adding the above code always pushes the owner name and owner image down a line.
Any help on what I might be doing wrong or if there is a cleaner way to dothis is appreciated.
You are appending a div, which is a block element- that is why you are getting the new line. You could either add a style of float:left to this element so it lines up next to the id or you could put the div in the card body instead- you may find it looks better there (especially on narrow width cards).
I'm trying to dynamically create a set of labels in my XUL Runner application. I have an HBox like so:
<hbox class="upload-attachments"></hbox>
If I manually assign a label element to it like so:
<hbox class="upload-attachments"><label value="test" /></hbox>
It works fine. Also, when I query the object in Javascript I can access the test label.
When I try and create new label elements programmatically it fails. This is roughly what I am doing:
var attachments = view.query_first('.upload-attachments');
var label = view.ownerDocument.createElement('label');
label.value = "Some value."
attachments.appendChild(label);
var childCount = attachments.childNodes.length;
The query_first method is just a call to the Sly Query Selector engine and in other cases works fine. The childCount value is updating appropriately, and as I said, I can access and manipulate any labels I manually add to the hbox.
Thanks in advance,
Either append it with the attribute set, or set the property after inserting:
var label = view.ownerDocument.createElement('label');
attachments.appendChild(label);
label.value = "Some value."
-- or --
var label = view.ownerDocument.createElement('label');
label.setAttribute("value", "Some value.");
attachments.appendChild(label);
The reasoning being that, before the element was inserted, the property setters don't work.