Bind Data To Non Unique Column

Tags: #<Tag:0x00007efc719e7db0>

hello,

i have nested column Headers in which there is non unique headers . i don’t know how can i bind data to specific header

headers like
Screenshot%20from%202020-08-20%2013-05-52

Financial Account is subject
subject1 => “Grade”,“Mark”
subject2 => “Grade”,“Mark”
subject3 => “Grade”,“Mark”

so i am struggling with data binding

Hi @rohit

nestedHeaders are an array of arrays that can contain objects

example

    nestedHeaders: [
      ['A', {label: 'B', colspan: 8}, 'C'],
      ['D', {label: 'E', colspan: 4}, {label: 'F', colspan: 4}, 'G'],
      ['H', {label: 'I', colspan: 2}, {label: 'J', colspan: 2}, {label: 'K', colspan: 2}, {label: 'L', colspan: 2}, 'M'],
      ['N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W']
    ] 

and data can be an array of arrays, array of objects, .JSON or a complex object. Here are all the types in use https://handsontable.com/docs/8.0.0/tutorial-data-sources.html

What is the exact issue you are getting while loading the data?

i am confused that how can i specify data for specific subject
like subject 1 mark and grade & subject2 mark and grade in data .
where mark and grade are non unique as it contains in multiple subjects
data like

data = [{
“Year” : “Year 1”,
“Semester” : "Semester 1 ",
“Total”: “78”,
“GPA”: “2”,
“Grade”: “A+”,
“Subject 1”: {
“Grade”: “A”,
“Mark”: “70”,
},
“Subject 2”: {
“Grade”: “B”,
“Mark”: “60”,
},
“Subject 3”: {
“Grade”: “C”,
“Mark”: “50”,
},
}]

Object keys refer to a place in the table, not a header. If you want to have a specific value under the column with the same name you would need to create two arrays for ‘data’ and ‘nestedHeaders’.

Here’s a demo that we can use to build the project https://jsfiddle.net/z9n603h5/

If you could send me a draft/drawing of the expected result I will help you to fill the data the way it fits the headers.

Thanks For Reply And Support
I have figured it Out .
You Can Close The Thread.
Thank You :slight_smile:

I’m glad to hear that it works well now :slight_smile: Thank you for the update.