Material-table: Editable table returns only strings

Created on 16 Sep 2019  路  4Comments  路  Source: mbrn/material-table

I have an editable material-table with some numeric columns:

  var columns = [{
    title: 'Naam',
    field: 'naam'
  },{
    title: 'Dag vd maand',
    field: 'dag',
    type: 'numeric'
  }, {
    title: 'Type',
    field: 'type'
  }, {
    title: 'Rekening',
    field: 'rekening'
  }]

When making the table editable, those edditted values are all strings. Is there any way to receive those values/variables as numbers? I store them as JSON so it would be nice to not have to convert every item to numeric. It is now displaying (console.log) as this:
{dag: "1"
naam: "Testrek"
rekening: "Algemeen"
type: "Rekening"}

ask to stackoverflow has a solution question

All 4 comments

I used the columns variable to check if name of the property is in the columns and if yes, if there is a field type set. If yes, parse this type.

Little cumbersome :)

You can also set a type on corresponding columns to numeric.

I have the same problem right now. As far as I can tell, @ericjansen1988 has selected "numeric" as column type, so parsing the values does not seem to use the type from the column settings. I have the same problem when creating entries.

I think #1450 is a related issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Mihier-Roy picture Mihier-Roy  路  3Comments

revskill10 picture revskill10  路  3Comments

bohrsty picture bohrsty  路  3Comments

slevy85 picture slevy85  路  3Comments

VipinJoshi picture VipinJoshi  路  3Comments