json format and display

json format and display

sorrysorry Posts: 4Questions: 0Answers: 0
edited June 2012 in General
Hi
I'm a newer.
Now, I have a json data like this:

{"teacher":
[
{
"id":"1522",
"teachername":"Eric",
"subject_grade":{
"subject":[5],
"grade":[18,19]
},
"mastername":"slina"
}
]
}

can i make it display like this: http://www.treasurydirect.gov/instit/annceresult/press/preanre/2010/2010_26week.htm

that's to say,the "subject_grade" display in two rows,and others display in on rows.

thanks!

Replies

  • koosvdkolkkoosvdkolk Posts: 169Questions: 0Answers: 0
    Rowspan is not allowed, as far as I know. Two workarounds:

    http://datatables.net/release-datatables/extras/FixedColumns/row_grouping_height.html

    or

    put small tables inside your cells: http://live.datatables.net/atuxud/edit#javascript,html,live
  • sorrysorry Posts: 4Questions: 0Answers: 0
    yes,it seems the method above can work.
    but,the json format in the example(http://datatables.net/release-datatables/extras/FixedColumns/row_grouping_height.html) is not same with mine.
    I want to know how to parse mine json data.
  • koosvdkolkkoosvdkolk Posts: 169Questions: 0Answers: 0
    This clue might help you find the answer
    [code]
    {
    "teacher":[
    {
    "id":"1522",
    "teachername":"Eric",
    "subject_grade": "518",
    "mastername":"slina"
    }
    ]
    }
    [/code]
  • sorrysorry Posts: 4Questions: 0Answers: 0
    thanks.
    It works well.

    is this must be set in json data?? if I don't want to change the json data,how can i get the same result?
    that's to say,can i call a function of datatables to achieve this goal?

    thanks agian
  • sorrysorry Posts: 4Questions: 0Answers: 0
    haha, thank koosvdkolk.
    i resolve it by using fnRender.like this:
    [code]
    "fnRender":function(oObj){
    return''+ oObj.aData.subject_grade.grade + '' + oObj.aData.subject_grade.subject + '';
    [/code]
  • koosvdkolkkoosvdkolk Posts: 169Questions: 0Answers: 0
    Great!
This discussion has been closed.