Cannot create property 'currency' on string 'c2'"

Hello. I stuck in problem with numeric column formatting.

I want to display value with comma seperator like currency.

However, the error occured "Cannot create property 'currency' on string 'c2'"

How can I fix this error?


this is my column definitions and dataset.

<e-columns>
<e-column type="string" field="cmdtyCd" headerText="품목명" :isPrimaryKey="true"
width="200" :allowEditing="false"
:template="eCommodityTemplate" :editTemplate="commodityEdit" ></e-column>
<!-- 품목에 연계된 기준가격리스트 dropdownlist, 기본값은 현재 기준가격리스트 -->
<e-column type="string" field="basPrcListCd" headerText="기준 가격 리스트"
:defaultValue="prcListCd"
:template="ePriceListNm"
:editTemplate="basePriceListEdit"></e-column>
<e-column type="number" field="stdPrc" headerText="기준 가격"
:editTemplate="basePriceEdit"></e-column>
<e-column type="number" field="cmdtyPrc" headerText="단가"
format="c2"></e-column> <!-- problem with here -->
<e-column type="string" field="invUnitNm" headerText="재고단위"
:editTemplate="baseUnitEdit" :allowEditing="false"></e-column>
</e-columns>


[
  {
    "prcListCd": "1004",
    "cmdtyCd": "Z0001000",
    "unitCd": "",
    "unitNm": "",
    "invUnitCd": "",
    "invUnitNm": "",
    "basPrcListCd": "1004",
    "basCffcnt": 1,
    "stdPrc": 1,
    "cmdtyPrc": 1,
    "passivAt": "N",
    "registUid": 0,
    "registDt": null,
    "updUid": 0,
    "updDt": null,
    "cmdtyNm": "P-box",
    "sleStndrd": "",
    "purchsStndrd": "",
    "basPrcListNm": "시험용-가격리스트-구매용"
  },
  {
    "prcListCd": "1004",
    "cmdtyCd": "R1003000",
    "unitCd": "",
    "unitNm": "",
    "invUnitCd": "",
    "invUnitNm": "",
    "basPrcListCd": "1004",
    "basCffcnt": 1,
    "stdPrc": 1,
    "cmdtyPrc": 1,
    "passivAt": "N",
    "registUid": 0,
    "registDt": null,
    "updUid": 0,
    "updDt": null,
    "cmdtyNm": "후루룩밀떡",
    "sleStndrd": "",
    "purchsStndrd": "",
    "basPrcListNm": "시험용-가격리스트-구매용"
  },
  ...
]




1 Reply 1 reply marked as answer

SM Shalini Maragathavel Syncfusion Team September 16, 2020 01:15 PM UTC

Hi Minkyu, 

Greetings from Syncfusion Support. 
 
Based on your query you need to display the value with comma separator for the currency column. By default in EJ2 Grid the locale value will be in en-US so the numbers will be in decimal format.  
 
To achieve your requirement we suggest you to use the German culture(‘de’)  as demonstrated in the below code snippet, 
 
<ejs-grid 
      ref="grid" 
      id="grid" 
      locale="de" 
      :dataSource="data" 
      :allowPaging="true" 
      :pageSettings="pageSettings" 
    > 
      <e-columns> 
        <e-column field="cmdtyCd" headerText="품목명" textAlign="Right" width="90"></e-column> 
        <e-column field="basPrcListCd" headerText="기준 가격 리스트" width="120"></e-column> 
        <e-column type="number" field="stdPrc" headerText="기준 가격" textAlign="Right" width="90"></e-column> 
        <e-column 
          type="number" 
          field="cmdtyPrc" 
          headerText="단가
          textAlign="Right" 
           format='C2' 
          
          width="90" 
        ></e-column> 
        <e-column type="string" field="invUnitNm" headerText="재고단위" textAlign="Right" width="120"></e-column> 
      </e-columns> 
    </ejs-grid> 


loadCldr(currencies, gregorian, numbers); 
setCulture("de"); 
setCurrencyCode('EUR'); 


Screenshot: 



please refer the below sample for your reference. 

Please get back to us if you need further assistance. 

Regards, 
Shalini M. 

 


Marked as answer
Loader.
Up arrow icon