Inherit Index from RepeatControl in nested custom controls - xpages

I have a Xpage with a repeat control. The index name is set. In the repeat is another custom control. Now a want the index in the nested custom control.
Is the only way to fill out a composite data?
I must unique a div class in the nested custom control. Is that the right way?
Thx

All components in an XPage are loaded initially as a tree hierarchy, the component tree. Any component has access to any element upwards and outwards from that branch. So if a custom control is nested inside a repeat, it has access to the repeat row and the variables relating to that row. So if you define the property indexVar="idex", just as any component on that row will resolve the variable name idex as the current row index, the same is true for a custom control nested in a row.
As long as indexVar has the same variable name in any XPage in which you nest the custom control, you don't have to pass the variable.

Related

How to add a foreign key reference to the primary key selector control

In the stock item screen, a custom grid is added. The DAC for the custom grid contains InventoryItem.inventoryID. That particular grid has a custom field in which the user wishes to search for, inside the inventory item selector control. I refer to the primary Inventory Item selector control for the stock item screen.
In normal circumstances, the customization manager allows you to select a particular field, and add that to the grid which appears inside the selector control. That is simple, since the field is a member of the same DAC. But in my case, I wish to add a column from the related data view. Since the primary data view has no knowledge of grid, the needed column is not available for selection. Also there is a high probability that records will be repeated inside the selector control, since the relation is one to many. This is acceptable.
I try the following suggestions.
1) use Cache_attached event handler, for InventoryItem.InventoryCD.
I add my own custom PXSelect statement which joins InventoryItem & CustomTable. But an error occurs: A foreign key reference cannot be created from the type 'PX.Data.PXSelectJoin`3[PX.Objects.IN.InventoryItem (ect)
2) Declare data view delegate for Items which yields type InventoryItem & CustomDAC. This approach returns no errors. However I am unable to select the user field, in the field selection panel.
3) Create a Project on InventoryItem DAC and write a PXSelect to join the two tables. I am unsure if this is the correct approach.
I wish to know if anyone has suggestions
You should follow the approach suggested here to concatenate field values from a related data view into a custom text column inside the InventoryItem table.

get selected value(s) from checkbox group within repeat control

How can I get the selected value from a checkbox group control within a repeat control in SSJS?
I want to check the selected value when the checkbox group is clicked.
The selectable value is something like:"|" + obj.unid
Same pattern as every time: Don’t try to read a value from a control. Always use data binding and read the value from the binding.
For controls in a repeat an Array or a Map will do the trick. Data binding removes the dependency on control type or name. A request scope or view scope variable should do.

How to update the attribute of composite component?

I have to create a composite component in which there are 3 things.
A text box(1) along with a button(2). And there is a data table(3) below to that text area.
So If user enter something in text area and click button the entered text is added into data table as a new row. So how can I perform this add functionality? And the list which is bind to data table is being passed as attribute in composite component.
What approach I am having currently is to use "componentType" attribute to bind java class to it. But how can I pass this List attribute to get updated?

Filter Values in ChangeContentType Control

I am using the SharePoint:ChangeContentType control (which renders as a DropDownList in New/Edit modes). I need to manipulate the values that are present in the rendered DropDownList in the CodeBehind. I can't manipulate them with JavaScript/jQuery because I will get a ViewState exception.
I can get a reference to the ChangeContentType control but can't cast it as a DropDownList and therefore I can't get a refernce to the items in it in order to add/remove stuff.
Any ideas?
How to find ContentTypeChoice control (DropDownList) in SharePoint:ChangeContentType control:
DropDownList dropDownList = (DropDownList) control.TemplateContainer.FindControl("ContentTypeChoice");
ContentTypeChoice control gets populated during page load event.

Orchard CMS - Pass data between local zones

In a list row template I need to know if a row field value matches the previous row's to toggle some HTML. How should I go about this?
I've tried caching the key in ViewBag, but that doesn't persist across the sibling zones.
The cleanest would probably be to override the List shape rendering (see http://weblogs.asp.net/bleroy/archive/2011/03/27/taking-over-list-rendering-in-orchard.aspx) and add the information you need on each item shape on the fly.

Resources