You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It took me quite a while to figure out that the documentation on Adding Custom Types, using the AmountField sample code, seems not to work as described.
What I did: I have set up a project using the same dependencies as provided by the ng-admin-demo. Compiling and running the demo using webpack works well. There is no difference to the online version of it.
Then I started to create a simple project from scratch, using the sample code from Adding Custom Types. Afterwards I added a field of type amount using
this dashboard display the fields id and product_name but hides the expected field price. When I change the field type to float or number, everything works as expected, but of course that's not the purpose of this exercise.
Then I debugged into the compiled ES5 code and I can confirm that the constructor of the AmoutField is invoked. However, if the field type is set to amount the field is not rendered, only the most outer, but empty wrapper:
<div ng-repeat="field in ::formController.fields track by $index" compile="::field.getTemplateValueWithLabel(entry)" class="ng-scope"></div>
May it be that a customized field also must override the getTemplateValueWithLabel method in order to fill its content?
Since the amount field is working in the demo, I was searching for an error in my setup. However, in the demo, the templates used to render the Catalog > Poster > Detail View are overridden anyway, so there the amount field is not used as described in the documentation.
The text was updated successfully, but these errors were encountered:
It took me quite a while to figure out that the documentation on Adding Custom Types, using the
AmountField
sample code, seems not to work as described.What I did: I have set up a project using the same dependencies as provided by the ng-admin-demo. Compiling and running the demo using webpack works well. There is no difference to the online version of it.
Then I started to create a simple project from scratch, using the sample code from Adding Custom Types. Afterwards I added a field of type
amount
usingthis dashboard display the fields
id
andproduct_name
but hides the expected fieldprice
. When I change the field type tofloat
ornumber
, everything works as expected, but of course that's not the purpose of this exercise.Then I debugged into the compiled ES5 code and I can confirm that the constructor of the
AmoutField
is invoked. However, if the field type is set toamount
the field is not rendered, only the most outer, but empty wrapper:May it be that a customized field also must override the
getTemplateValueWithLabel
method in order to fill its content?Since the amount field is working in the demo, I was searching for an error in my setup. However, in the demo, the templates used to render the
Catalog > Poster > Detail View
are overridden anyway, so there the amount field is not used as described in the documentation.The text was updated successfully, but these errors were encountered: