Trying to add a new tab items from the page cs file in the Page_Init method which contains a PXSmartPanel in Iframe mode.
Initially I just created the blank tab
for (int i=0;i<3;i++)
{
PXTabItem tabItem = new PXTabItem();
tabItem.Key = "myKey"
tabItem.Text = "myTab" + i;
tabItem.Visible = true;
this.tab.Items.Add(tabItem);
PXSmartPanel smartPanel = new PXSmartPanel();
smartPanel.RenderIFrame = true;
smartPanel.InnerPageUrl = "thispage" + i;
..... {other smartpanel properties}
tabitem.TemplateContainer.Controls.Add(smartPanel);
}
This does create the tabs on my page and works/looks correctly in Chrome however in Firefox, the style of the iframe rendered is always 150px regardless of the style set in the smartPanel above.
Tried adding the following
smartPanel.height = new Unit(100, UnitType.Percentage);
smartPanel.Style["height"] = "100%";
Tried even forcing a specific size of say 600px.
As a secondary test, I added directly to my page the tab items, smart panels and those render correctly in both Chrome and Firefox.
I also attempted to create a "dummy" / "template" and use the tabitem.CopyFrom() method to set it up. This also renders correctly in chrome but not firefox.
Has anyone added tab items directly from the code behind file and have any hints on what property I am missing here?
Related
I want to hide certain elements in the view.
I managed to hid (with view..HideCategoryTemporary) all the elements I wanted except the marked one in the picture attached.
3D_House_before_hide
Element snoop
This element is a building section of category OST_Viewers.
Manually hiding the element category via the view works, but fetching all OST_Viewers in the code and hiding them does not work.
The following code contain the building section elements in addition to the grids,
FilteredElementCollector viewers_sections = new FilteredElementCollector(doc, v_id).OfCategory(BuiltInCategory.OST_Viewers);
FilteredElementCollector grids = new FilteredElementCollector(doc, v_id).OfCategory(BuiltInCategory.OST_Grids);
FilteredElementCollector elements_to_be_hidden = new FilteredElementCollector(doc, v_id);
elements_to_be_hidden.UnionWith(viewers_sections).UnionWith(grids)
foreach (Element e in elements_to_be_hidden)
{
cur_view.HideCategoryTemporary(e.Category.Id);
}
I've checked that viewers_sections contains the mentioned building sections however it is not hidden from the view.
After hide
How do I hide these building sections?
Please use View#SetCategoryHidden instead to turn off the visibility of the category, the result of the View#HideCategoryTemporary will be reset after closing the file. Here is the working example:
var gridCate = this.Document.Settings.Categories.get_Item(BuiltInCategory.OST_Grids);
var sectionsCate = this.Document.Settings.Categories.get_Item(BuiltInCategory.OST_Sections);
using(var trans = new Transaction(this.Document))
{
trans.Start("Hide Grids & Secions");
this.ActiveView.SetCategoryHidden(gridCate.Id, true);
this.ActiveView.SetCategoryHidden(sectionsCate.Id, true);
trans.Commit();
}
Using Vaadin Flow Java API I would like to emulate a Vaadin 8 Window feature: particularly I need to emulate Caption behaviour.
I mean a fixed top "Title" not scrollable as the real content of the Dialog. Anyone can tell me some Example I could learn from ?
Thanks in advance
This is the workaround I found.
public MainView() {
Button button = new Button("Click me",
event -> {
Dialog dialog = new Dialog();
HorizontalLayout horizontalLayout = new HorizontalLayout();
VerticalLayout verticalLayout = new VerticalLayout();
Div headerDiv = new Div();
Div bodyDiv = new Div();
bodyDiv.getElement().getStyle().set("overflow", "auto");
bodyDiv.getElement().getStyle().set("max-height", "420px"); // !!!
dialog.add(headerDiv, bodyDiv);
headerDiv.add(horizontalLayout);
bodyDiv.add(verticalLayout);
horizontalLayout.add(new Label("Hi there !"));
for (int i = 1; i <= 20; i++) {
verticalLayout.add(new TextField("TextField_" + i));
}
dialog.open();
});
add(button);
}
The trouble is that I have to fix max-height size to avoid scrolling of all the contained components. So I cannot take advantage from the auto-size behaviour of the Dialog Container. Also tried using setFlexGrow, but I did not reach the solution.
Any Hint ?
In Vaadin 10+ there is no component called Window, but there is component called Dialog. It does not have Title like Window, but otherwise it has similar baseline. I.e. it is popup. Based on your question you have found already that.
Dialog itself is component container, which means you can add components there. I would just create e.g two Divs (the simplest of the layout components in Vaadin 10). I would style the first one to have fixed height and place the Title there. And then I would apply component.getElement().getStyle().set("overflow", "auto") to the other one, which is the actual content body. The mentioned style will enable the scrollable feature. You could potentially use VerticalLayout / HorizontalLayout instead of Div as well depending what you need.
See also: https://vaadin.com/docs/v10/flow/migration/5-components.html
In Dynamics CRM, how do you set the height of an iframe programmatically? The following function doesn't do anything, the iframe always comes up the same size. Even when you go to iframe properties and change the row numbers there, it still doesn't cause any changes in size.
function doOnLoad(sender, args) {
setIframeHeight();
}
function setIframeHeight() {
//lowest control in iframe
var element = $('btnInsert');
//the following line gets called, and what's displayed is 25
alert(window.parent.parent.frames[0].document.getElementById('IFRAME_TransactionProduct_RA_d').parentNode.height);
//the following line doesn't do anything
window.parent.parent.frames[0].document.getElementById('IFRAME_TransactionProduct_RA_d').parentNode.height = 5000000;
}
you may try this in iframe code:
//set div(show iframe) height = iframe body height * 1.2 window.parent.parent.frames[0].document.getElementById('IFRAME_ApprovalProcess_d').style["height"] = ($(body * 1.2)) + "px";
//but it may get some issue if the contenter in the form not load,so that window.parent.parent.frames[0].document.getElementById('IFRAME_ApprovalProcess_d') this can be undifined.
To get the height of a element you can do like you have but to set you have use style, like that:
parentNode.style.height = "100px";
I have created a Sharepoint WebPart, and I have given it a custom ToolPart that includes a Grid (a Telerik RadGrid, to be exact, though that is rather irrelevant). I have populated the grid, and created a GridButtonColumn object to add to the grid:
protected override void CreateChildControls()
{
GridButtonColumn c = new GridButtonColumn();
c.ConfirmText = "Really Delete?";
c.ConfirmDialogType = GridConfirmDialogType.RadWindow;
c.ConfirmTitle = "Delete";
c.ButtonType = GridButtonColumnType.LinkButton;
c.Text = "Delete";
c.UniqueName = "DeleteColumn";
grid.Columns.Add(c);
// ...
grid.DeleteCommand += new GridCommandEventHandler(Grid_DeleteCommand);
}
The grid renders correctly - populated with data and with the delete button present.
Now, when I click any of the delete button, the Grid_DeleteCommand() event does not get triggered. However, when I add a random button outside of the grid, it's click event gets triggered:
Button b = new Button();
b.Text = "Hello World";
b.Click += new EventHandler(Button_Click);
I'm not able to debug on this installation of Sharepoint (or maybe I can, but attaching to the process hasn't allowed me to do so yet), so the method of both of those events is simply a redirection to Google. That is how I check to see if the events fire:
string AbsoluteUri ="http://www.google.com";
Page.Response.Redirect(AbsoluteUri);
The only difference I can see between the two is that, with the 'Delete' button, it is nested inside of a Grid control, whereas with the 'Hello World' button, there is no nesting.
How would I be able to have the Grid_DeleteCommand fire when I click the button in the grid?
Using the Telerik Grid control, you should specify button's CommandName in your code.
Adding this line should solve the problem:
c.CommandName = "Delete";
I've created a custom edit form as a simple aspx page in VS2010 (inherits from LayoutsPageBase) which uses the SharePoint Web controls LookupField control to display a drop down list of values from a custom type
The form displays correctly with the drop down box containing the expected range of values
The ControlMode is set to the same as the FormContext (though I have tried explicitly setting this to Edit)
But on the postback the value of the dropdown list is not set - the selected item index is set to -1
How can I correctly use the LookupField control to capture a selected value from the user?
Could it be because I'm adding the controls declaritivly in the aspx and then setting the list id etc from the SPContext in the page load event? - see code snippet below (not the prettiest but just trying to get it to work at this point):
from aspx:
<SharePoint:FileField ID="FileNameText" InputFieldLabel="Name" runat="server" ControlMode="Display"/><br />
<SharePoint:LookupField ID="FeedType" runat="server" />
<SharePoint:TextField ID="FeedStatus" runat="server" />
....
in the code behind page load:
if (!IsPostBack)
{
SPItem feedFileItem = SPContext.Current.Item;
FileNameText.ControlMode = SPContext.Current.FormContext.FormMode;
FileNameText.ListId = SPContext.Current.ListId;
FileNameText.ItemId = SPContext.Current.ItemId;
FileNameText.FieldName = "Name";
FeedType.ControlMode = SPControlMode.Edit;
FeedType.ListId = SPContext.Current.ListId;
FeedType.ItemId = SPContext.Current.ItemId;
FeedType.FieldName = "FeedType";
FeedStatus.ItemContext = SPContext.Current;
FeedStatus.RenderContext = SPContext.Current;
FeedStatus.ControlMode = SPControlMode.Edit;
FeedStatus.ListId = SPContext.Current.ListId;
FeedStatus.ItemId = SPContext.Current.ItemId;
FeedStatus.FieldName = "FeedStatus";
}
UPDATE
Ok I managed to get my form working by adding the controls in the code behind in the override of CreateChildControls - this is in line with the majority of the samples I've seen on the net.
But can someone explain why my approach didn't work and whether I can do this all in a declarative way in the aspx?
During postbacks selected values from lists are simply ignored if the list control isn't populated. So if you choose item 2 and the list items are null it will simply ignore the response parameter and not set the Value property. This is because ProcessPostData occurs prior to LoadData. Even if you were to remove the !IsPostBack on the LoadData method it still wouldn't work because ProcessPostData still occurs before LoadData and you didn't load the list prior to processing the postback.
A simple way to fix this is move your initialization code into the EnsureChildControls method of your Application page.
protected override void EnsureChildControls()
{
base.EnsureChildControls();
...
FeedType.ControlMode = SPControlMode.Edit;
FeedType.ListId = SPContext.Current.ListId;
FeedType.ItemId = SPContext.Current.ItemId;
FeedType.FieldName = "FeedType";
...
}