List view mass update action with dependant picklists - salesforce

I got a list view where I need to mass update some records.
On the layout I have 3 picklists values : P1, P2, P3
P1 is controlling P2 and P2 is controlling P3.
Now when I update P1 and P2, it happens that sometimes P3 doesn't have a value for the selected P2 value so P3 is put at grey by the UI which is OK.
However if I previously had a value on P3, once I click on the update button, it's keeping the old value of P3 instead of putting it at blank.
I know I could handle it with triggers or put a value on P3 for every P2, but that's just weird that it doesn't come as a standard behaviour.
Am I missing something here ?
Thanks

Try a onChange() event and handle it with JavaScript

Related

ReactJs: Modelling Bidirectional Infinite Scroller with data limit

Our application uses infinite scrolling to navigate large lists of items. As of now it is one way scrolling only that is when a user scrolls to bottom of the list, we make an api call to fetch 10 records and append the same in rendered list.
We want to make it bidirectional scroll with few changes in it:
Assumptions: 1 page is equivalent to 10 records in list
Suppose we make api calls to fetch pages and each page is having the 10 records and we want to maintain a list of 3 pages or 30 records only, if we fetch more pages then we remove the 1 page from the rendered list items
Let me explain it through few use cases:
Initially webpage loads with 1 page or 10 records.
Then user scrolls down to bottom and 1 more page is loaded.
Suppose list is having records of 3 pages (p1, p2 and p3) that is 30
Since list is reached a threshold limit of 30 records, Now if user scrolls to bottom, we fetch the fourth page and also remove the first page so that list will still be having
30 records but changed pages that are p2, p3, p4
If user scrolls to top again we remove the last page that is p4 and loads p1 page and prepend it to list
Just to be more clear, Below is execution of use cases
Initially list is having 10 records or first page p1
and threshold is of 3 pages or 30 records
User scroll down and reaches the threshold of 3 pages
p1 -> p2 -> p3
Scroll to bottom again
p2 -> p3 -> p4
scroll to bottom again
p3 -> p4 -> p5
scroll back to top
p2 -> p3 -> p4
scroll back to top
p1 -> p2 -> p3
Since once the list reaches its threshold limit of records we will be having the fixed length scrollable content so how do i manage the scroll top so that user still has some scroll area left to fetch more content.
Please advise any approach or any existing library which supports such use cases

Flink: Append an event to the end of finite DataStream

Assuming there is a finite DataStream (from a database source, for example) with events
a1, a2, ..., an.
How to append one more event b to this stream to get
a1, a2, ..., an, b
(i.e. output the added event after all original events, preserving the original ordering)?
I know that all finite streams emit the MAX_WATERMARK after all events. So, is there a way to "catch" this watermark and output the additional event after it?
(Unfortunately, .union()ing the original DataStream with another DataStream consisting of a single event (with timestamp set to Long.MaxValue) and then sorting the united stream using this answer did not work.)
Maybe I'm missing something, but it seems like you could simply have a ProcessFunction with an event time timer set for somewhere in the distant future, so that it only fires when the MAX_WATERMARK arrives. And then in the onTimer method, emit that special event if the currentWatermark is MAX_WATERMARK.
Another approach might be to 'wrap' the original data source in another data source, which emits a final element when the delegate object's run() method returns. You'd need to be careful to call through to all of the delegate methods, of course.

angular one way binding

I am using angular 1.3.15. I want to bind data, such a way that, first time variable($scope.twotap_builtin_cart.sites[sikey].shipping ) assigned data from $scope.shipping_address. Later on even if , variable named $scope.twotap_builtin_cart.sites[sikey].shipping data modified, it should not haveve any impact on other $scope.shipping_address. I am talking about one time binding or one way binding
you should use angular.copy() for deep coping
$scope.shipping_address = angular.copy($scope.twotap_builtin_cart.sites[sikey].shipping)
this way even if $scope.twotap_builtin_cart.sites[sikey].shipping modify its not gonna bind to the $scope.shipping_address
I think that you are not looking for binding but simply assigning a value of a variable to another. When working with JSON objects (and $scope is one such object), making a = b is NOT copying the contents of b to a, but making both a and b reference the same object. The best way is to perform the assignment as:
b = JSON.parse(JSON.stringify(a)) ;
In your case:
$scope.twotap_builtin_cart.sites[sikey].shipping = JSON.parse(JSON.stringify($scope.shipping_address)) ;
One you do this, both variables hold the same information but they can be changed without affecting the other.
A similar requirement was asked in this question:
Edit with bootstrap modal and angulajs
Similarly, you can use the AngularJS copy function to replicate your data without any lingering bindings.
$scope.twotap_builtin_cart.sites[sikey].shipping = angular.copy($scope.shipping_address);
Here we are copying the value from $scope.shipping_address into the other variable. Now even if you make a change to $scope.twotap_builtin_cart.sites[sikey].shipping, this will not be reflected in $scope.shipping_address - which is what you want.

Select data binding for an object

I'm getting a strange behavior when binding the following object to a select:
REGIONSH = {0:"All Regions",1:"Europe",2:"North America"};
HTML (where region is a integer for key):
<select ng-model="REGIONSH[region]" ng-options="name for(key,name) in REGIONSH">
The behavior is that the list is populated correctly with the correct option selected, but when I change the region variable the selected entry changes fine, but suddenly both the original and the new selections are named the same thing.
For example, I would select the second element in the list, and the original one would be renamed to "North America" from "All Regions".
The desired behavior is to have a select where I can chose from each of the values in the object while having the key as the option's value.
The way you have your html:
<select ng-model="REGIONSH[region]" ng-options="name for(key,name) in REGIONSH">
It will display the list correctly, but whenever the user makes a choice the name of the region ("name for(key,name)") will be bound to wherever ng-model is pointing to.
Meaning when the user makes a choice for say the first option, it ng-model will effectively perform
REGIONSH[region] = /*name of the selected region*/;
Which assigns a name to the region at index region.
What you probably want is ng-model="region", so the values are assigned to the region variable, and not the options. ( Or any other variable you want to store the choice in; probably not in REGIONSH though )
Then you'd also need ng-options="key as name for (key, name) in REGIONSH, so that it still displays the name, but now assigns key whenever the user makes a selection. ( Read here on the many ng-options formats you can use )
Meaning when a selection is made it performs
region = /*key of the selected region*/;
The final result would be
<select ng-model="region" ng-options="key as name for(key,name) in REGIONSH">

g_signal delays (C, GTK+)

I've got a little GTK-Application with two buttons (A, B) and a drawing area (C).
When I click on A, C's size should be recalculated and set with gtk_widget_set_size_request(). This will cause an expose-event, whose handler will calculate some data. Further, the click on A will emit a clicked signal at B, whose handler needs the data calculated by C's expose-event.
In fact everything works fine, but the expose-event delays somehow, and the clicked handler is called before and the data (you may guess it) is missing.
a_handler() {
new_size = calculate_size();
gtk_widget_set_size_request(C, new_size); //Will cause expose-event
g_signal_emit_by_name(B, "clicked");
}
b_handler() {
calculate_something(data); //Error
}
c_handler() {
draw_something();
data = calcluate_data();
}
What can I do?
Gtk (and most other GUI toolkits) does the painting and event handling all in one thread. Therefore when the expose event is emitted, it goes into a queue and will be handled only after a_handler returns.
The best approach in my opinion would be to move the calculation somewhere else, if there is not some good reason to tie it into GUI drawing. For example, there could be a separate method calculate_data that is called both from b_handler and c_handler.
The next best way is to call gdk_window_process_updates to force the expose event to be handled immediately:
http://developer.gnome.org/gdk/stable/gdk-Windows.html#gdk-window-process-updates
The ugly fix is typically to add calls to gtk_main_iteration(), for instance between the call to gtk_widget_set_size_request() and the signal-emission.

Resources