-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make custom view datasources observable #183
Comments
Hi, one of the big differences between the Commerce SDK and the Retail SDK is the decoupling of the POS extensions from the knockout.js library that defines observables. Accordingly, we will not be able to modify the control interfaces to include observables. Please refer to the gas pumps sample view linked below for an example on how to use knockout.js observables and the data list in the Commerce SDK. |
Hi @lukedgr, thank you for the response.
I've reviewed the sample On first glance, this doesn't quite seem like it translates to what our customization is doing.
It seems like the Just sending a bit more context here about our customization as described below: We have a custom view here (replacing the OOTB return transaction view) which displays returnable products (with RETURN_QTY and AVAIL_QTY). Each time the cashier scans any returnable item, the RETURN_QTY and AVAIL_QTY columns need to be updated +/- by one increment per scan (code and ui). With legacy_sdk, our view's datasource was defined as observable. Hence upon scanning in the legacy_sdk, we were able to apply the +/- updates in code and then simply (re)assign the updated observable datasource like this and the framework would redraw the grid with the updated values: I understand that the commerce_sdk would have decoupled from knockout.js. |
@ax365, the IDataList interface has a data property that is settable. When the sales lines are updated you should set the data property to equal the new, updated value. This can be done in a knockout ObservableArray subscribe method if needed, but the scenario you are working on is achievable using the new Commerce SDK controls. |
Extensibility request:
Allow for custom view datasources to be observable.
Context:
This post is related to issue #182.
In that issue, I had the following screenshot:
Selected in red, there is the initialization of the custom view datasource.
In the legacy RetailSDK, when creating custom views, we were able to define the custom view datasource as
ObservableArray<ProxyEntities.SalesLine>
.With the new CommerceSDK, it appears that there is an explicit requirement to define the custom view datasource as
readonly ProxyEntities.SalesLine[]
.As a result, with CommerceSDK, we no longer have the ability to easily update/redraw grid column values on the custom view because the data is static.
For example, when the user scans an item on the custom view using the
NumPad
from issue #182:The handler methods are indeed triggered and the code manages to update the datasource values properly.
But, the custom view does not render (redraw) these changes because the datasource is no longer an observable.
The text was updated successfully, but these errors were encountered: