Not intuitive behavior of dataSchema with default value

Tags: #<Tag:0x00007efc6b5f1068>

What I wanted is to use dataSchema for newly creted rows with some fields to be prepopulated (those are fixed values by design - so I would make it readonly)

http://jsfiddle.net/kquztfr9/8/

  dataSchema:{
  	foo:null,
    bar:"im the default",
    third:null,
    forth:null
  }

This renders 4 columns which is fine. However the default value for bar is not rendered. Moreover if I fill all the columns in the row with for example A B C D, data will look like this (click button in the fiddle)

{
  3: "d",
  bar: "im the default",
  foo: "a",
  forth: "c",
  third: "b"
}

which is rather nonsense to me.

I would expect that

  1. value for bar will be rendered
  2. idx 3 did not show in the data
  3. Since I have declared my data schema to have 4 columns, it should be 4 - now it is 5

What am I doing wrong here?

Hi @sebastian.choina

In order to render the value you have to assign the data to individual columns. When I did that not only the value is shown as is should be but also the data from getSourceData is correct.

Please, check the demo and let me know if that works for you: http://jsfiddle.net/2rbhe0mu/

Thank you Adrian, this is something that I have missed indeed. Solved!

That’s great to hear!