I'm trying to add a price field into a custom entity I've created but the digit disapeared and it's rounded.
How to keep 2 digits ?
->addColumn(
'price_ht',
Table::TYPE_FLOAT,
null,
[
Table::OPTION_SCALE => 2
],
'Price HT'
);
This is interpreted as 10,0
in the database instead of (10,2) which would accept digits i guess so the scale option doesn't work.
This is what I have in my form
<field name="price_ht">
<settings>
<validation>
<rule name="required-entry" xsi:type="boolean">true</rule>
</validation>
</settings>
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="dataType" xsi:type="string">Magento\Catalog\Ui\Component\Listing\Columns\Price</item>
<item name="label" xsi:type="string" translate="true">Price HT</item>
<item name="formElement" xsi:type="string">input</item>
<item name="source" xsi:type="string">entity</item>
<item name="dataScope" xsi:type="string">price_ht</item>
</item>
</argument>
</field>
And this is what I have in my listing
<column name="price_ht">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="filter" xsi:type="string">text</item>
<item name="label" xsi:type="string" translate="true">Price HT</item>
</item>
</argument>
</column>
EDIT : Tried to add precision and same result
->addColumn(
'price_ht',
Table::TYPE_FLOAT,
null,
[
Table::OPTION_SCALE => 2,
Table::OPTION_PRECISION => 2
],
'Price HT'
);