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

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.

Related

JointJs: Set Custom attribute Value

I am trying to set custom attribute value through a form. But if I click the element again it shows the properties previously assigned rather than showing the one.
I want to input SiteStation variable's value from user and assign it to that particular element. For the time my element is there on the graph it should have that value attatched it.
http://jsfiddle.net/avinash2618/6umUH/157/
cell.set('attributes/stationName',stationName);
you can try setting the text property of the custom attribute as below
cell.attr('stationName/text', stationName);
or
if it is a view
cellView.model.attr('stationName/text', stationName);

Inherit Index from RepeatControl in nested custom controls

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.

How can I create a user defined value in Construct 2?

I want to be able to have the user type a number or use the slider bar to pick a value and have that value be stored as a global variable. How can I do that?
For getting input from the user, you can use the TextBox Object in Construct 2. If you put one in your layout, you can access it's current value in the Event Sheet at any time. You can use the On Text Changed (below) event and grab the current value by using the Text property (also below) and assign it to a Global Variable.
TextBox Manual
https://www.scirra.com/manual/117/textbox
On text changed
Triggered whenever the text in the field is modified, by typing, backspace/delete, cut/paste etc.
Text
Get a string containing the text currently entered in to the field.
Check out this little tutorial video on variables in connect 2 http://blogs.msdn.com/b/gamewords777/archive/2015/07/20/10-minutes-with-construct-2-global-and-instance-variables.aspx
Also note - instance variables are handled differently than global.

XPages - Repeat Control - Get item Value

I would like to create a custom control which shows 3 columns,
column 1, value selected from checkbox (this is ok)
column 2, editable box , this is showing but not working 100%
column 3, a button to remove the row (still to be done)
So far:
After selecting the options, click "Create Rows" button and 1 row appears for each selected option.
Problem:
Only last value in editable box, is used, how can I get the value from each box ?
getComponent("inputText1").getValue() only shows the last value.
Example code is on this URL:
http://snipt.org/AAgd3
You bind the column values to array variables. Exercise 23 has a complete working example: http://www-10.lotus.com/ldd/ddwiki.nsf/dx/Tutorial-Introduction-to-XPages-Exercise-23
You just need to adjust it to the source/destination of your data. Let us know how it goes
If you want to bind them dynamically, you can also do this with expression language. It takes a bit of getting around in order to get the fields editable, but the way I've resolved it is to pass a calculated ID into a custom control, then using that for the binding.
For example: If I'm Working with a list of Unique Part Names, I may pass into my custom control a variable for a Comment. If I pass this in as fieldNameComment to my custom control, I can dynamically bind it to an inputText element through the following code.
I'm using a DominoDocument passed in as the dataSource.
Calling the Custom Control:
<xp:repeat var="CurrVal" value="#{DataSource}">
<xc:DynamicTableRow dataSource="#{EmissionsDocument}">
<xc:this.fieldNameComment><![CDATA[#{javascript:CurrVal+"Comment"}]]></xc:this.fieldNameComment>
</xc:DynamicTableRow>
</xp:repeat>
Inside the Custom Control:
<xp:inputText id="inputText5"
value="#{compositeData.dataSource[compositeData.fieldNameComment]}">
</xp:inputText>
As long as (for some reason) none of the string calculations are performed within the expression language syntax, this will yield an editable field. In my testing, if I tried to calculate a value by concatenating any strings, the field would be bound, but not appear as editable under any circumstances. If you want to bind directly to fields, this may be a good approach, but if you want to save your array and parse it through java, then Stephan's solution also works great Hope this helps!
Appended: Added repeat control to show iteration through the data source. Each iteration of the Data Source yeilds a value, CurrVal, to which the string "Comment" is appended. This creates a series of FieldNames based on the Values in the DataSource that are bound to inputs within the custom control called DynamicTableRow

How do I create a pager for a view that shows the alphabet instead of numbers?

I have a need to have an alphabetical pager for a view. I didn't see any of the samples or the custom pager that addresses this. I would think that this would be a pretty common thing.
MJ
I'm not quite sure what you really mean by an "alphabetical pager", but I assume you might be looking for some kind of alphabetical navigator like we have it in the personal NAB inside the Notes client, right?
If so you're not really looking for a pager but for an alphabetical view filter. Here's one way to get there:
create a panel, give it a distinctive ID like "viewContainer" or
something. Put your view panel into the panel; of course the view's main sorting order must be alphabetical
create a 2nd panel above "viewContainer", no ID necessary here
put a repeat inside this new panel and bind it to a new JavaScript array, like that:
new Array("a", "b", "c", ... , "x", "y", "z");
enter a collection name for the repeat, like "letter"
put a link control inside the repeat. The link's label will be
computed to the repeat's collection name, i.e. "letter".
assign an onclick event to the link setting a sessionScope variable to the current collection name's value, like that:
sessionScope.filter = letter;
set the event's refresh mode to partial so that it refreshes your viewContainer panel
highlight your view control inside the viewContainer. In its data properties look for the property field labelled "Filter by column value" and make it computed. Enter this code:
sessionScope.filter;
That's it.
Edit:
of course you can build the repeat's datasource array dynamically from the view itself. So, instead of building that static a-to-z array you could also use something like this:
#Unique(#Left(#DbColumn(#DbName(), "yourLookupView", viewColNumber), 1));
That should return an array only containing those letters that really are in your view.
Also you could another static link control outside the repeat resetting the filter to show all entries. It would be built like the repeated link with the onclick event calling this code:
sessionScope.filter=null;
Enjoy!
I would go for this: make a view categorized by formula #Left( value; 1). Then render result of #DbColumn as pager by repeat or some ExtLib component (links list, navigator, menu). Each link will either limit shown view to "single category" or jumps to "starts with" character.

Resources