How to identify changed row in editable grid in LightSwitch (C#) - grid

I have an editable grid for invoices and a few checkbox columns like invoice, sent to customer / ok to invoice. I have fields updated by/updated on for these boolean fields.
I want to update these two columns if checkbox values have been changed. I am not sure how can I do this. Any help?

The way that I do this is by implementing the INotifyPropertyChanged interface for the SelectedItem property of the DataGrid. Perfect for "I want to update these two columns if checkbox values have been changed".
If you need code just let me know.

In the screen designer for the page select the property from the query (on the left) that represents the checkbox. Then click the drop down next to the "write code" link and implement the method for xxx_Changed.
Here you can then set values for your other fields based on this input.

Related

set default value for detail in master/detail relationship form widget dialog button

I have a master/detail relation similar to the relations sample provided.
In my example department has a one to many relationship with employee
I have a form widget(department) which has a button to insert an employee.
when I click on that button the correct dialog form is displayed but I am allowed to enter any department which I do not want.
I am looking to have the relation defaulted to the "parent" widget where it was clicked and ideally not be editable.
It's hard to give an exact answer without seeing your app, but you should probably replace the dropdown in the form with a label, that will make it not editable. You can bind the value of the label to the relation just like the value of the dropdown was bound.
A slightly easier option would be disabling the dropdown (look for the Enabled probably in the property inspector). But that could be confusing for your users since they might think it should be editable.
(Alternatively, you could just remove the field altogether if it's not important to show the relation.)
I think this only answers the "not editable" part of your question, if you want it to be pre-filled you either need to do some scripting, or use relation data sources.
I suggest using relation data sources, so right now you probably have something like:
app.datasources.Emp.create(), which creates a new employee.
Instead, you can use widget.datasource.relations.Emp.create(), which will create a new employee which has a relation to the current item in widget.datasource. If this button is placed in your department form widget, then that means it will create an employee related to whatever department is shown in the form.
Note that none of this stops users from changing the department of an employee, it just changes the UI. In lots of cases that is enough, but you may also want to add some server-side security controls if it's important to limit which users can create employees, change departments, etc: See https://developers.google.com/appmaker/security/secure-app-data

Using bindings with BrazosUI buttons

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

Show values in grid according to a combobox selected value

I have a combobox, on which I have to choose one option. That option determines which values should be shown on the comboboxes of a grid. The values to show on the grid's comboboxes are on a table. Right now, I'm showing all of them, but I need to filter it down.
The user must choose a value on combobox #1, and the comboboxes inside the grid (#2) should only show the related values. So far, I haven't been able to accomplish this.
Thanks in advance!
Refresh your drop down list as follows:
&l_field.ClearDropDownList();
/* select values required by sql */
&l_sql = CreateSql("...");
While &l_sql.Fetch(&l_key, &l_descr)
&l_field.AddDropDownItem(&l_key, &l_descr);
End-While;

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.

Resources