In theory what I want to achive is pretty simple:
You choose an item from a sap.m.select which is a category.
This effects which items can be selected in a second sap.m.select that contain items that still need to be requested from a backend system.
On choosing one of the items in the second sap.m.select, a backend request for the full information of the choosen item should be triggert.
This works so far as long is I change the item in the second sap.m.select manually.
But if I choose a category this applys a Filter to the model that is the source for the second sap.m.select.
The problem is: there is no change triggert when the filter is done an thus the current item of the second changed (because one item can only have one category).
I already tried a few things, starting with manually fireing the change event of the second select as soon as I it filter. But all solutions so far did not achieve what I had planned.
(in the example of the manuall fired event after the model for the second select is filtered, the selected item of the second sap.m.select is not yet set. I need that item to know which item to query)
I only have some hacky solutions remaining, like some delay for firing the change event or modifing the handler of the change event to check the model, and the filter, for the first entry and query this in case the selected item of my sap.m.select is not yet set.
But is there nothing like an onBindingUpdated handler or something like this?
Related
I have Drupal 7.58 site where there's a select list with 15 items that come from an entity reference. When I put a debugging statement into form_type_select_value in includes/form.inc, the whole array of items is there, so I know the query is working, and the form element should be built correctly.
But when the select list is display, the sixth element goes missing. I've found a short term way to circumvent this, by adding a dummy sixth item, but that's not going to fly in the long term.
What I need to know is where does it go after form_type_select_value?
edit: More info
This is happening in an Entityform where the field type is Entity Reference and the Widget is Select List. In Manage Fields under Entity Selection, I select an entity called Store, in Simple mode. There are 15 Stores, and these are sorted by the Title property, sorted in the Ascending direction.
When I sort in Descending direction, a different item is missing, but it's always the 6th from the top.
I've debugged it up to the point where the data comes in, before it's rendered, and it's all there in the outgoing array.
How do I cause APEX to refresh a chart (graph) after I change the value in a text box/select list/etc that is used as a parameter in the chart's pl/sql statement?
I'd like it to look as professional as possible and minimize the portion of the page that must be refreshed (i.e., "ajax-like", which is the standard in 2018).
Create a dynamic action on the text box/select list/etc that is changed with event "change"
Create a true action and select pl/sql and write
Begin
null;
end;
In page items to submit select your items
Create a second true action after the first and select Refresh. Then select region as affected element and select your chart. Remember that the option 'Fire on initialization' must be set to NO
See Approach B, below, for the optimal solution.
Approach A
The simplest option (that is less professional) is to modify every text box/select list/etc of interest to submit the page when the value of the text box/select list/etc changes. As an example, for the select list, go to its settings->page action on selection and change the setting to submit page.
There are two main downsides to that approach:
Most of the page will refresh, which is jarring to your user, and
If you're using a plugin, or the type of item that you're using doesn't support that approach, then you're out of luck.
Approach B
A more complex solution that yields a more professional result follows. This solution involves dynamic actions, which I will probably not fully explain here. However, the information should be enough for the user to figure it out.
Let us suppose that you have two things: (1) a select list whose value is used as a parameter in a (2) chart's sql source statement.
To get the chart to update every time you make a new choice via the select list, you need to:
Create a dynamic action for the select list of interest. You do this by clicking on the select list, going to the dynamic action tab (the lightning bolt); right-click on the item; click select dynamic action; give it a name and set the event to change and make the selection type an item and set the item to the name of the select list you're watching.
Create a true action for that dynamic action that executes pl/sql code (you can do this by modifying the show action that was created by default in 1.). Set the pl/sql code to null;. Then under items to submit, specify the name of the select list of interest.
Create a second true action that refreshes the region that contains the chart.
You'll need to make sure that the sequence assigned to 2. is a smaller number than the sequence assigned to 3.. This should happen by default, but it's an area you can get tripped up.
Inapplicable Approach C
In Apex 5.something, they added a feature called Cascading List of Values. This feature allows you to specify that one item depends on another item for its values. For example, if you have a select list that allows the user to choose a department, and then you have a second select list that allows you to choose an employee from the chosen department (which presumably obtains its values from a query involving the value chosen in the first select list), you can tell APEX to refresh the second select list whenever you update the first.
You do this by editing the second select list. Under its settings goto list of values->cascading LOV parent item(s). Add the first select list as a "reverse" dependent (aka, "parent"). This will ensure that any time the first select list is updated, the second select list is also updated.
For better or for worse, charts do not have the cascading LOV parent item(s) setting. Thus, this solution does not apply to this question.
I have a standard REST API list of items, each of them accessible on its URI
GET /items/1
{"item":{
"some":"data",
"selected":false
}}
Now I want to add a constraint that only one item in the list can be selected. In other words, if one item is selected, all other items should have false in their selected field. Basically it should behave like a radio button group.
I see three options how to implement it, all of them bad
Keep it as it is. If someone updates an item, the server changes the value in previously selected item. This unfortunately makes the resource not cacheable. I update one item but the other one changes its state as well.
Change the resource so the whole list is one entity. The client updates it at once and it's up to him to make sure that only one item is selected. I do not like this solution, since the items are logically separate entities and I want to access them separately.
Force the client unselect the previously selected item first and only after that let him to select the new one. It's quite complicated for the client and it can lead to ugly race conditions if more clients are trying to select an item.
Is there a better solution that I do not see?
the items are logically separate entities and I want to access them
separately.
While this may be true for individual items, it cannot really be said about their selection.
As you describe it, the selection is not really a state of a single resource. It's a property of the whole group of items.
I would therefore manage the selection by issuing POST requests to the resource representing the collection of items
POST /items?selection=<item_id>
I would also disallow the modification of the selected property by any requests to single item resources.
Perhaps it would be a good idea to remove the selected property from the representation of an item and make the selection a separate resource.
GET /items/1 - read the first item
GET /items/selected - read the currently selected one
or perhaps make the selection a property of the items resource as a whole.
{
"items" : [
{"id" : 1, "some" : "data"},
{"id" : 2, "some" : "data"}
],
"selected" : 2
}
or both, either way I wouldn't keep collection-related data in the representation of an item in the very collection.
I have a form in Access where I have 2 unbound multi-select listboxes, with some code to move items between them.
Each of the fields in the table which are shown in the listboxes are boolean values - if the value is true then the name of that field shows up in lstSelected, and if false shows up in lstUnselected.
The listboxes have a RowSourceType of Value List, and the value list is generated programatically by looking at the underlying record and constructing a string with the field names where the boolean values are true for lstSelected and False for lstUnselected.
On the form I have two buttons, cmdMoveToSelected and cmdMoveToUnselected. When I click on cmdMoveToSelected it changes the boolean value of the underlying field for any selected items in the lstUnselected listbox from false to true by executing an SQL string, then rebuilds the value lists for both of the listboxes.
I have all of this working just fine. If I do a me.lstUnwanted.requery and a me.lstwanted.requery then everything moves and shows up correctly, and the underlying fields are edited correctly, BUT when I click on anything else on the form I get the error:
The data has been changed.
Another user edited this record and saved the changes before you attempted to save your changes.
Re-edit the record.
Now I've found a way around this (jobDetailsID is the primary key of the record being dealt with):
Dim intCurID as Integer
intCurID = Me.JobDetailsID
Me.Form.Requery
Me.Recordset.FindFirst "JobDetailsID = " & curID
This requeries the form and then moves back to the current record, and this gets rid of the error, however it causes there to be a delay and the form to flicker while it opens back at the first record, changes back to the correct record and repopulates the list boxes.
Is there a way to do away with this error, or get it to trigger programmatically so I can catch it by turning the warnings off via vba?
Thanks in advance.
Maybe it helps not to bind the form to the table being altered by cmdMoveToSelected, but to a query that doesn't contain all the boolean fields. If cmdMoveToSelected alters one or more boolean fields, the record is changed, but the query result isn't. Not sure if it's sound though.
It also sounds a bit like a design problem rather than a form problem, storing options in boolean fields instead of into a related table.
Probably the best solution would be to not directly update the current record in the table while the Form is dirty. Instead, update the values of the fields within the form itself (Me!FieldName) as the items are moved from one List Box to the other, and let the form write those values back to the table as usual.
I seem to have fixed it, though the fix doesn't make a great deal of sense to me.
I added in a Me.Refresh to the button click code, after I had requeried the two listboxes and it appears to have stopped the message from coming up. However this only works when I have the JobDetailsID textbox visible on the form (though I expect this is arbitrary and any field-linked textbox would work).
Can anybody explain to me why this works? I'd like to understand fully when to use requery, refresh etc
I've had this sort of thing happen when I've left the form RowSource query hanging in place after converting the controls to unbound textboxes, etc. The general Form rowsource query (to bring in all fields I might possibly end up using) provides me with a query-list identical to the table fieldnames, making it simple to select them for control-names as needed. Works fine, but you have to remove the form rowsource query after all the names are matched-up. (After which DLookup and BeforeUpdate works for getting and storing values and changes.)
This might be simple but I am new to Oracle. I am using Oracle 10g and have a form that lists our information from a linked table in a tabular Layout. The last column of data is a "list Item" item type that has the Element list of Enabled (T) and Disabled (F).
What I need is when a user changes this dropdown, to disabled, I want ONLY that row to have some of the columns be disabled and not the entire column.
This is also assuming on load of the form, it will disable and enable rows of data depending on what values are being pulled from the EnabledDisabled column in the database.
Thanks for the help!
Option 1: use the ENABLED item property.
Unfortunately Oracle Forms does not allow changing the ENABLED property of an item at the item instance level.
What you can do, however, is enable or disable the whole item when the user enters a record - use the WHEN-NEW-RECORD-INSTANCE trigger - depending on the value of the current record's value for the list item, the trigger would set the ENABLED property to PROPERTY_TRUE or PROPERTY_FALSE.
Of course, your list item would also have the same code in its WHEN-LIST-CHANGED trigger.
The downside to this approach is that the whole column will "look" disabled to the user, and they will not be able to select a different record using those disabled items.
Option 2: use the INSERT_ALLOWED and UPDATE_ALLOWED properties.
You can set these properties at the item instance level using SET_ITEM_INSTANCE_PROPERTY. You would set them in the block's POST-QUERY trigger, as well as in the list item's WHEN-LIST-CHANGED trigger.
This would not, however, change how the items look on the screen. To solve this, you could also set a visual attribute at the item instance level (e.g. change the items to use a dark gray background or something).
More comments.