Author Topic: dataIndx nested json  (Read 2121 times)

bwt

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 17
    • View Profile
dataIndx nested json
« on: December 04, 2020, 05:26:29 pm »
hello :)
i need to know how to get tthe dataIndx for nested json to call inside of nested colModel
thanks a lot
i wish to hear near from you cause it's urgent case

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: dataIndx nested json
« Reply #1 on: December 04, 2020, 05:35:15 pm »
Sorry your requirement is not clear enough.

Please elaborate with a small example if possible.

bwt

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: dataIndx nested json
« Reply #2 on: December 04, 2020, 05:43:59 pm »
i have a nested object ,
let's consider this object
var obj = {

data1:"x",
data2:"y",
data3 : {
data1-1:"xx",
data1-2: {
data1-2-1:"xxx"
}
}
}
in this example we have main columns , is data1 , data2 and data3
and data3 have two column, data1-1 and data 1-2 and so on
i need to get the dataIndx for data 1-2-1 , to print the results in the column

bwt

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: dataIndx nested json
« Reply #3 on: December 04, 2020, 05:49:34 pm »
https://jsfiddle.net/i3laddin/pv0ey9ju/4/ you can understand me from this array in this fiddle
i type comment for what i need

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: dataIndx nested json
« Reply #4 on: December 04, 2020, 09:00:54 pm »
Your jsfiddle has only data

Code: [Select]
    var data = [{
        rank: 1,
        data: {
            company: 'Exxon Mobil'
        },
        revenues: '339938.0',
        profits: '36130.0'
    }, {
        rank: 2,
        data: {
            company: 'Wal-Mart Stores'
        },
        revenues: '315654.0',
        profits: '11231.0'
    }, {
        rank: 3,
        data: {
            company: 'Royal Dutch Shell'
        },
        revenues: '306731.0',
        profits: '25311.0'
    }];

What's the colModel of the grid? If you want to deduce colModel from data itself, then what it should be?
« Last Edit: December 04, 2020, 09:09:58 pm by paramvir »

bwt

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: dataIndx nested json
« Reply #5 on: December 05, 2020, 12:43:59 am »
seems like you not understand me , i need to know how dataIndx of nested object , why need fiddle ??