Radio buttons used in a rad grid in batch edit mode - radio-button

I am trying to find any information about using a radio button in a rad grid in batch edit mode. I have created a template column, then added the radio button control, but it doesn't work in batch edit mode (nothing saves back to the DB). Is it even possible? I can't find anything on the Telerik site so I am suspecting its not supported. Thanks.

The Radio list is not supported in the batch editing mode. Such integration simply has not been implemented. The closest available option at this time is using a dropdown list: http://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/batch-editing/defaultcs.aspx. Generally speaking, the standard way of editing boolean fields is through a checkbox column and not a radio button list - check the Discontinued checkboxes column.
What the grid does is that it loops through the controls with JS code when cells are opened and closed and determines control types and the proper API to use (e.g., $get().control.get_value() for dropdownlists, or $get().value for standard inputs). You can try implementing similar logic in the batch editing events.
You can try to use a RadRadioButtonList with the two items declared in its markup and its client-side API (see the get_selectedIndex() and set_selectedIndex() method: https://docs.telerik.com/devtools/aspnet-ajax/controls/radiobuttonlist/client-side-programming/radiobuttonlist-object) together with the following approach of working with templates: https://docs.telerik.com/devtools/aspnet-ajax/controls/grid/data-editing/edit-mode/batch-editing/working-with-templates.
The idea is to have the radio button list in the edit template of the column and to select the correct item in it according to the newly opened cell value on the client, then fetch the selected item from the button list and put it in the grid data source.
You can find one example that you can try using as base in the following thread: https://www.telerik.com/forums/radiobuttonlist-in-gridtemplatecolumn.
Showing a radio button list in the item template is also something that is not supported, as the editing would basically happen in the "display" mode of the cell, and not in the edit mode of the cell. You could try using the server ItemDataBound event and FindControl() (see here: https://docs.telerik.com/devtools/aspnet-ajax/controls/grid/rows/accessing-cells-and-rows#accessing-controls-in-template-column) may let you set initial values based on the data source for the radio button lists without data binding them. Then, perhaps a hidden field or hidden checkbox can be used for the actual data binding (see the template article above). You could also try using the batch editing manager changeCellValue() method on the client-side events of the radio button list, in a fashion similar to this article: https://docs.telerik.com/devtools/aspnet-ajax/controls/grid/data-editing/edit-mode/batch-editing/how-to/editing-checkboxes.
Another approach you can consider is to use the client-side events of the radio button list and immediately upon change to call a service that will update the database. This may simplify the template handling logic (you could do this in a read-only column) but it goes against the purpose of batch editing to invoke one request with a lot of data, and you would also need to secure the service.
Another online resource to check is
https://docs.telerik.com/devtools/aspnet-ajax/controls/grid/data-editing/edit-mode/batch-editing/how-to/editing-checkboxes

Related

Set Devexpress ASPXGridView columns Editable after Bind Data (VB.Net)

I have DevExpress ASPxGridView which bind data from the code and columns will add dynamically. I want to set the columns editable. (User should able to type on grid cells)
Is there any way to do this? (Something like my code)
For i As Integer = 0 To dgstkReceivd.Columns.Count - 1
dgstkReceivd.Columns(i).EDITABLE = True
Next
Unlike the WinForms Grid, a user has to manually switch the WebForms Grid to Edit mode. DevExpress ASPxGridView provides several Edit modes:
Edit Form
Popup Edit Form
Inline editing
Batch editing
See the Data Editing help topic on DevExpress.
For your requirements, I guess, inline and batch edit modes will suite them.
Batch edit mode does not need a user to click the Edit button.
Use the ASPxGridView.SettingsEditing.Mode property to enable the required Edit mode for the Grid. For Edit modes except Batch, you also need to show the Edit button. Use the properties of the Command Column to do this.
Here is a demo: Grid Edit Modes
Updated
To prevent a particular column from being edited, you can use the GridViewDataColumn.ReadOnly property. You can also set the e.cancel parameter of the ASPxClientGridView.BatchEditStartEditing event handler to true to disable editing based on your condition on the client.
You can manage whether user can edit the specific column or cannot via the OptionsColumn.AllowEdit option.
This option is in effect if the View's ColumnView.Editable property is set to true.
The default state of these options makes columns editable if it possible. For example, if the column in DevExpress XtraGrid is mapped to read-write property of a specific data-object then this column is editable by default.
Related help-articles:
Assigning Editors to Individual Cells
WinForms Grid: Prevent Editing in Specific Cells.

Setting up recycle bin functionality in Archer GRC

When deleting records within the platform, this action is not reversible via the front end. Is there a way to allow users to remove a record from their view without actually deleting the record?
You can simulate recycle bin functionality within Archer GRC by adding a record permission field that grants read access to "Everyone". If read access is no longer required then an editor of the record can go in and change "Everyone" to a group called "Recycle Bin."
Please note that if there are other record permission fields in the application, users or groups may still have access if they are selected in those fields. Perhaps You can set up a dropdown status field for the user to select "Recycle Bin" and use this condition for automatic record permissions to revoke permission to the record depending on the requirements or workflow of the application.
Solution shared by Igritte might be somewhat confusing for end users.
End user will see greyed out "Delete" button in the top toolbar, but he has to select "Recycle Bin" in the form. This solution was not accepted by my business owner at some point.
As a work around for "Soft delete", I wrote a custom object overriding "Delete" button functionality.
1. User doesn't have delete access to the record, so JavaScript code will make "Delete" button look like active and available.
2. Once the button is clicked, custom object will populate value in the
hidden value list and simulate the click on the "Save" button.
Update: Note that Custom object needs to hide the value list first once the page is loaded. Here you will need to use a JavaScript and do the following: [a] locate the value list DOM object and [b] set display attribute to none. I used jQuery library to do both. This way your value list is not displayed, but you still can use it to control data driven events.
3. With hidden value populated and submitted, record permission will hide this record from the end user.
Note that custom object hides one value list on the layout as well.
If for some reason JavaScript doesn't load properly, user simply will not be able to click on the grayed out "Delete" button.
Update: Hidden value list can be populated by custom object using JavaScript code as well. You need to identify the form tag "input" in HTML code of the page and set attribute "value" to the desired state. I used jQuery library to do this as well.
I have this solution in production working fine with IE11, FF and Chrome.
I can't share the code, but with WC3Schools JavaScript guides and 4 hours you can write and test it yourself with very little JavaScript skills.
Sometimes you have to use custom objects when you want to get a user-friendly solution of not available functionality.
Good luck!

Cocoa Bindings with NSComboBox

I have Cocoa Bindings working with a NSComboBox that shows and autocompletes values based on a Managed Object Context. My issue is trying to get the current selection after the user either selects from the dropdown or the autocomplete text is used. I know that the Array Controller class has a selected objects property, but when I try to use it to pull out the selected object I get nothing. With a NSComboBox do I have to set the selection once the text/selection of the combo box occurs or is there something I'm missing setting up the Array Controller.
Thanks
A combo box allows any arbitrary string to be entered, right? (You're not limited to the items you can autocomplete, unlike a popup menu.) So it doesn't have a concept of selected item, since the text in it might not correspond to any item in your database.
This question seems to address a similar issue, declaring it to be unsolvable using only bindings, and links to a blog post that has some hints on what code needs to be added. The gist of it is that, when the user finishes editing the combo box, you create your own fetch request in code and use the response from that to link up the model.

Turn off field programmatically in VB.Net

I'm creating an addin button in Arcmap via VB.net that when clicked, runs the identify tool. But I want only selected fields to appear in the identify dialog. I thought of hiding the unnecessary fields and then showing them again after the button is used.
Does anyone know how to programmatically turn off/on field?
you have to iterate the fields in layer and then set visible property into false .
see this link in
gis.stackExchange

JasperReports dynamic input controls

I'm currently trying to create a JasperReport report with some special input control behaviour. My needs are:
four input controls, two of them are dateboxes, the other ones are radio buttons
depending on radio button choice, one of the databoxes should be visible or not
so if option 1 is chosen, show both dateboxes; if option 2 is chosen, show only one datebox
I wonder if there's a "clean" solution - didn't find anything.
Any pointers will be helpful.
The Print when expression is not relevant for input controls on JasperReports Server.
There is no built-in support for hiding and showing an input control based on the value of a different one. The infrastructure for cascading input controls can certainly be extended to achieve this... but it would not be trivial.
The path I would take is to customize the .jsp page that displays the input control. There is a section in the JasperReports Server Ultimate Guide called "Customizing the Input Controls Form" which would get you started down this path.
For datebox part, you can use print when expression to decide whether certain blocks of the report is visible.
For other "input", if you meant some data you want to display inside the report, you can make some Parameter in your report, then set the Parameter from user input before you export the report.