Wicket's input looses behavior after the form it's in is submitted - forms

I have a form and a series of panels containing inputs inside it, as a list. When I click the add button, the form is submitted and a new item is added into this form. Input inside a newly created panel gets date-picking behavior. The problem is that it cancels behavior applied to inputs which already were on that form (added previously). Inputs in other forms are not affected.
Each field behavior is applied onto has unique name. Values inside inputs are processed correctly.
How to preserve behavior applied on old inputs?

How to preserve behavior applied on old inputs?
You probably put your input fields into a ListView, right? If so, try calling ListView.setReuseItems(true). This setting makes sure that when you add something to the listview and it is rendered again that the old items (with the old input fields and their behaviors) will be kept instead of creating new ones.

Related

PowerApps Get Selected Item from Lookup to make a Button Visible at the Command line bar

I want a button from the command line bar to be visible or invisible depending on whether a record has been selected in the lookup field from the main form or not.
If no record has been selected, then the button should be displayed. Otherwise not.
For this problem, I want to use the Power Fx in PowerApps, but I haven't found a command yet, which shows me the content or something like that of the lookup field. Other field data types like text have worked without problems.
With Javascript, I already managed it without problems, but I would like to do it also in PowerFx if that should work.
Screenshot: https://i.stack.imgur.com/uqDJ6.png
The records come from the Table Company, where the attribute is Companyname.
Commands where I think they might work:
If([Selected Record];true;false);If(IsBlank([Selected Record]);true;false);If(IsBlankOrError([Selected Record]);true;false);If(IsEmpty([Selected Record]);true;false)
I guess there are 2 scenarios:
The Lookup form control element is a Dropdown with a Selected output property. Then your approach would work like If(IsBlankOrError(DataCardValue1.Selected),true,false)
If your form control element is a ComboBox then you could use If(CountRows(DataCardValue1.SelectedItems)>0,true,false) or the above described IsBlankOrError.

How to make TextMeshPro Input Field work in layout?

I'm having odd issues trying to use Unity's Text Mesh Pro Input Field UI element. I don't actually know if the layout is causing it though.
I have a scroll view which uses a vertical layout to organize objects under the content object. Each object in the scroll view has a horizontal layout inside it which fits two input fields next to one another so essentially the Scroll view has two columns of input fields.
However I'm getting odd behavior from the input field. When I start typing it won't show the input until I've entered two characters (i.e. I type '0' and it shows nothing then I type another '0' and it will show '00'). Additionally I have some code that automatically populates the input field with default value, below is an example of how I do this:
gameObject.GetComponent<TMP_InputField>().text = numVal.ToString();
However the values never show up, but I can confirm that they are being populated by checking the inspector window while the game is running. Under the TMP_Input Field component, the 'Text' field shows the correct value but I can't see it in the input box.
I'm getting no errors or warnings.
Is it the scroll view or the layered layouts that are confusing the Input Field's script? Something else? Any advice, help, and questions are appreciated.
EDIT:
I've found that it may have something to do with the way the objects are added to the scroll view. The content of the scroll view (which has the vertical layout) get's objects added to it during run time. This is done through instantiating a prefab.
Instantiate(DoubleInputNodePrefab, contentObject.transform);
This prefab object has the horizontal layout and two children, each an input field. If I add this prefab to content window before I run the game it works fine (expect that none of my intended code works since it relies on modularly adding and removing these objects) but I can give input and it looks fine.
WORK AROUND:
I won't consider this a solution but it is a work around I'm going with for now. Using a 'normal' input field rather than a Text Mesh Pro one doesn't create the same issues and works as intended.

How to configure agGrid grouping so it works like an accordion

is it possible to configure agGrid grouping so that it behaves like an accordion i.e. only one group can be expanded and when opening new group previously opened is closed?
Not sure if this answers your question, but I am sure this might be the only direction you'll have.
There is a method provided on gridApi - onGroupExpandedOrCollapsed
So I think (again, need to check) that this function would be called as its name suggests, and you can collapse the other rows (whichever is opened) and achieve your functionality.
Be cautious while using this as there is comment given by ag-grid
we don't really want the user calling this if one one rowNode was
expanded, instead they should be calling rowNode.setExpanded(boolean)
- this way we do a 'keepRenderedRows=false' so that the whole grid gets refreshed again - otherwise the row with the rowNodes that were
changed won't get updated, and thus the expand icon in the group cell
won't get 'opened' or 'closed'.

How to stay focused on form field?

I have a form with multiple inputs and buttons for the user. At the start, only the first input is enabled and a few of the buttons.
When the first input is entered, (when the user presses enter), if there is no input or if the input is invalid, then I want the focus to stay on the input field. But when i try using MyControl.setFocus(), the focus is not staying on the field.
How is it possible to keep focus on the same field in this situation?
Using setFocus in the modified method of a form control is a no-go, as it confuses AX tab order.
You could make the conditional setFocus call from the enter method of the next field control.
It is not bullet proof, back tab is not handled, but is might do it for you.
The invalid case should be handled by the validate (or better validateField if a bound field), method of the first field.
Also consider setting the Skip property on display only fields.
You can return false from the modified() method (AX 2012 R3) and this too seems to prevent the focus from leaving.

How to dynamically insert and remove rows

I'm looking for a widget which can be dynamically resized. I need to append and remove rows.
There are a methods coming with Grid, like gtk_grid_insert_row or gtk_grid_insert_next_to, but I don't find any xxx_remove_xxx method.
I'm developing a simple http client (to test an api). And I'm adding the possibility to append and remove "GET" variables dynamically.
The UI is made with rows containing a combobox (for variable selection), an entry (for its value) and on the last row a remove button.
Every time I set a variable, a new line (new available variable) is appended.
And every time I unset a variable, the corresponding line is removed.
thanks.
Gtk.Grid doesn't have a remove method; but Gtk.Container does. Since Grid is a Container, you can use gtk_container_remove.
The docs for this are here:
https://developer.gnome.org/gtk3/3.8/GtkContainer.html#gtk-container-remove
I think the widget you are looking for is Gtk.ListBox. It's a container so you can add and remove rows easily.