Imagine that we have table with some data ( attached file: img1.png )
Using this data I created pivotDataSource for my Kendo pivotGrid like this:demo
As we can see our data looks like:
var
someData = [
{
Question1:
'Q1Answr1'
,
Question2:
'Q2Answr1'
,
Question3:
'Q3Answr1'
,
Question4: 1
},
{
Question1:
'Q1Answr2'
,
Question2:
'Q2Answer2'
,
Question3:
'Q3Answer2'
,
Question4: 1
},
{
Question1:
'Q1Answr3'
,
Question2:
'Q2Answer3'
,
Question3:
'Q3Answer3'
,
Question4: 1
},
];
For each question property we use only one answer, and our model looks like:
model: {
fields: {
Question1: { type:
"string"
},
Question2: { type:
"string"
},
Question3: { type:
"string"
},
Question4: {type:
"number"
}
}
},
...
But if I want to use table with data wich will look like: ( attached file: img2.png )
I must separate this data in this way: (find all possible combinations for answers): ( attached file: img3.png )
And only after that I can create someData js obj as we saw above.
var
someData = [
{
Question1:
'Q1Answr1.1'
,
Question2:
'Q2Answr1.1'
,
Question4: 1
},
for our pivotGrid.
The problem is, that we can have many questions ( 100+ questions) and for each question we can have ( 1-5+ answers) , so if I'll have in my row 5 answers for each question I must create (5*100)! unique combinations of answers, and after that i can create data for my pivotGrid where each data item will have one answer for one question.
Why I must do that ?
According to documentation Kendo dose not allow us to use Array type in model, so we cant write like this:
fields: {
Question1: { type:
"Array"
},
So my questions are: 1) Does kendo have mechanism which allow me use array in my model. For example i will give it data wich will looks like:
var
someData = [
{
Question1:[
'Q1Answr1.1'
,
'Q1Answr1.2'
],
Question2:[
'Q2Answr1.1'
,
'Q1Answr2.2'
,
'Q2Answr2.3'
],
Question4: 1
},
and it will build me pivot grid like this: ( attached file: img4.png )
but not like this ( attached file: img5.png )
2.Maybe you can advise me another solution to solve this problem with data separation. For example can we create a pivot grid configurator UI where we can choose only two items (two questions) (one for column , one for row), and after that , we will calculate all possible combinations of theirs answers , and after that we can use this data for our pivot grid.In other words: can we initialize our kendo pivot grid and kendo pivot grid configurator using one dataSource after that detect wich data was dropped in columns and rows after that make some calculations and prepare another dataSource ( using this dropped data) and replace old dataSource using new dataSource .Maybe you can advise me another solution to solve this problem with data separation.Thank you.