Concatenate nested object in single column

Concatenate nested object in single column

dan92ddan92d Posts: 1Questions: 1Answers: 0
edited February 2016 in Free community support

This is json:

[{
        "film": "The Avengers",
        "genre": "Action",
        "date": {
            "year": 2016,
            "month": 2,
            "day": 11
        },
       "localTime": {
            "time": {
                "hour": 17,
                "minute": 57,
                "second": 0,
                "nano": 0
            }
        },
       "ticketNumber": 1,
        "price": 8.5
    }]

Here there are html and javascript and json indented(in javascript area): https://jsfiddle.net/vyrydr2b/4/

Hi, how i can concatenate, in a single column "Date", the three values date.year, date.month, date.day to create something like 2016/2/11? Also, how can i concatenate, in a single column "Time", the two values localTime.time.hour, localTime.time.minute to create something like 17:57?
Sorry for my bad english :(
Thank you in advance

Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Answers

  • loukinglouking Posts: 259Questions: 52Answers: 0

    You are loading data in object form, so that makes it easy. Take a look at columns.render .

    See https://jsfiddle.net/w2qtjo2j/ . I'm getting an ajax error from the fiddle, but I think the syntax is correct or at least close

  • allanallan Posts: 63,089Questions: 1Answers: 10,388 Site admin

    You may also need to use ajax.dataSrc set to be an empty string if you are just returning an array of objects, rather than an object with a data property.

    Allan

This discussion has been closed.