Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to create merged row? #4

Open
oneumyvakin opened this issue Aug 9, 2014 · 1 comment
Open

How to create merged row? #4

oneumyvakin opened this issue Aug 9, 2014 · 1 comment

Comments

@oneumyvakin
Copy link

I'm trying to create table like http://i.imgur.com/txmc4Rb.png from json object.
Could you please advice how JSON should looks like to get this table?
I've tries this
[
{"Title1": "Col1", "Title2": "Col2", "Title3": "Col3"},
{"Title1": "Col1Row1",
"Title2":["Col2Row1", "Col2Row2"],
"Title3":["Col3Row1", "Col3Row2"]
}
]
But it's just merge Col2Row1 and Col2Row1 into single cell.

@jongha
Copy link
Owner

jongha commented Aug 10, 2014

@oneumyvakin The code below can help you to solve your problem.

[
  { "Title1": "Col1", "Title2": "Col2", "Title3": "Col3" },
  { _data:[ { _data: ["Col1Row1"], rowspan: [2] }, "Col2Row1", "Col3Row1"] },
  [ "Col2Row2", "Col3Row2" ]
];

or

[
  { "Title1": "Col1", "Title2": "Col2", "Title3": "Col3" },
  { _data:[ { _data: ["Col1Row1"], rowspan: [2] }, "Col2Row1", "Col3Row1"] },
  { "Title2": "Col2Row2", "Title3": "Col3Row2" }
]

But, It is hard to use in your situation. I think this is a point to improve this library. Thanks for your report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants