Using bindings with BrazosUI buttons - ibm-bpm

I'm used to using boolean bindings with IBM buttons to track if a button is clicked. The button in Brazos UI can be bound to any variable type but doesn't make automatic updates to booleans. How do I use bindings with Brazos UI buttons to track which was last-clicked?

The binding of a button is really only useful in tables. The acceptance of ANY variable type for the binding of a button stems from the use of determining the index of a selected row or obtaining the entire row object:
If you bind and integer to the button in a table, the binding will update with the index of the row when the button is clicked.
If you bind a variable of the same (singular) type as the table's binding, then clicking the button will update the binding with that row's data.
Both of those are handy interactions with the table control but don't work for tracking which button is clicked when used elsewhere on a coach. For that, you want to utilize the 'Button Control ID' configuration option. The most direct method is to bind the same string variable to all of the buttons you need to track. When clicked, a button will update that shared variable to match its own control ID. You can then use that unique ID in various scripting checks to take button-specific actions.
See the BP3 Help Center article for greater detail about this, including some examples: https://support.bp-3.com/hc/en-us/articles/217985767-Using-Button-Binding-with-Brazos-UI

Related

How to make pop-up data reflect selected record?

The case:
I have Activities as datamodel.
I have set Activities to have many-to-many relationship with themselves to represent a Parent / Child relationship.
I have set up an accordion widget. Each row of the accordion contain basic data about the Activity record + some buttons.
I have set one of the button's onClick functions to open a popup, which allows me to edit the Activity detail in a form.
When I click a different record from the same accordion, the form from the popup reflects the data in the selected record.
The problem:
I have nested accordions which represent the "Child" Activities of the Parent Activity.
I have also added a similar button, which opens a popup. I can open the popup, which targets the child records, but cannot make it open the specific record, from which I pressed the button.
So the popup open by default on the first child.
Please help - how can I make the popup change naturally to reflect the datasource / selected record of even nested datasources?
What I tried:
In order to try and make to popup work I have tried to set the datasource based on the relationship:
Activities: Sub_Activities(relation)
This works to the extent of showing the related items, but popup content does not dynamically change on clicking a different child record or clicking the button from a different child record.
In both cases what is shown is the first child record.
What I understand is that you have a set up in which you click a button and a popup shows. The popup should let you view/edit the record referenced in the row where the button is. If that is the case, then probably you already have almost everything setup for the next thing to work. First, add a string custom property to the popup and name it selectedKey. Then, on the onClick event of the button that opens the popup, add something like this:
var key = widget.datasource.item._key;
app.popups.MYPOPUP.properties.selectedKey = key;
app.popups.MYPOPUP.visible = true;
Now, go to the popup content and add the following on the onAttach event handler:
var key = widget.root.properties.selectedKey;
widget.datasource.selectKey(key);
This is the general idea of how to make it work; However, in order for it to work, your datsources in the widgets should be properly set up. Good luck!

Something like setVisible() for Dynamics AX 2012

Is there any way to do that?
I mean, if the form fullfill specific conditions setVisible true or false to a control in the form? Or if i check a CheckBox, show some specific ComboBox?
Thanks in advance for your help
I would recommend enabling and disabling fields, rather than hiding them.
Open a Supplier, and on the Invoice and Delivery fast tab choose select the Calculate withholding tax CheckBox. This is the VendTable form.
The Calculate withholding tax control will enable and disable a second control depending upon the value selected.
The second control has it's property AutoDeclaration set to Yes, and the event that fires the change can be found on the forms VendTable data source. Find the relevant field (VendTable > Data Sources > Vend Table > Fields > TaxWithholdCalculate) and notice that the modified method has been overridden, changing the control's enabled property. It also has a visible property should you want to remove it from view.
Top Tip: In case that you are not aware, you can right click on any control on a form and choose the Personalise option from the context menu. From there is a form which contains a very useful box called System name. You can find the name of the control/table field from this.
I suggest you this solution for your second problem:
if i check a CheckBox, show some specific ComboBox?
I assume your form is complete (it has all controls needed : comboboxes, checkboxes, etc). And the controls AutoDeclaration-property is set to 'Yes'.
In the AOT expand the Form till you find the CheckBox, expand it as well
Right-click its Methods and select 'Override method' >> 'Clicked'
Finally you can add this code and save/compile the form:
myComboBox.visible(true);
It should look like:
public void clicked()
{
super();
myComboBox.visible(true);
}

How to get the selected rows in ASPxGridView?

I have a grid with ASPxCheckBox in Data Item Template. How to get KeyFieldValue of all rows whose checkbox is checked. I am trying to do this using client-side code and do it for whole grid not on visible index. Is it possible?
Note: I cannot use simple row selection command column as I am using it for some other purpose.
if you dontuse client-side code, you should use detailrow in aspxgridview. And you must use beforeperformdataselect event. if you really need checkbox, you can add checkbox a new field in asapxgridview.

What's the best practice for generating spark radio buttons?

I have a list of radio buttons, which I want to be able to both set the value of programmatically and for the user to set the value of manually.
I have a small list of data items which I want to display as options in a list of radio buttons. The objects are stored in a model object, as is the currently selected item. The currently selected item is bound to the radiobutton group. The radio buttons are generated using a spark list.
I am having a problem setting the list programatically - whenever I set the current value on the radiobutton group to the first value in the list, all of the radio buttons are cleared, where the first one should be selected. I when checking in the debugger, I found the likely reason - there are two radiobuttons in the group that point to the same value, one of which isn't showing. My best guess is that the list control has created an extra item renderer which it is holding on to in case it needs to scroll the list.
Is there a way to create radioButtons based on an ArrayCollection without using a list? Failing that, is it possible to prevent the list from generating the extra item?
Use a DataGroup with a dataProvider (an ArrayList of objects holding data) with a custom item renderer that creates the radiobutton that you need. Add proper bindings of the data object to the radiobutton (maybe even do 2 way binding for quick saving).
In the end, I gave spark best practices the finger and used a repeater, which created the correct number of radioButtons with no extras. It may be slow, but slow iteration over a set of less than ten items is O(I don't care).

List Component that acts as if control was permanently pressed

I have a list control and i want the user to be able to select many items at a time. Thus I want it to act that if the control key is pressed while he is clicking. Eg if he clicks on a selected row it should become unselected and if he clicks on a unselected row it should become selected.
Do you have any idea how to do this?
Thanks,
Dennis
If you want to follow standard UI Precedent; then set allowMultipleSelection to true and teach your users to use the control and/or shift button to select multiple items.
If you want to select multiple items without having the using press the shift or control button you'll have to extend the List class. I did a sample a while ago using the DataGrid:
http://www.flextras.com/blog/index.cfm/2009/7/23/Flextras-Friday-Lunch--Episode-22--07032009--Auto-Select-DataGrid
http://www.flextras.com/labs/AutoSelectDataGrid/
http://www.flextras.com/labs/AutoSelectDataGrid/srcview/index.html
You can probably use the same technique with a List. But, I don't recommend this approach.

Resources