cscan / vue3-excel-editor

Vue3 plugin for displaying and editing the array-of-object in Excel style.
MIT License
231 stars 51 forks source link

Nested json #36

Closed samgevorgyan closed 5 months ago

samgevorgyan commented 6 months ago

Hi Could you please explain how can I use nested JSON as a column header field?

for example

{
...
car:[{car1: red},{car2: blue}]
....
}
 <vue-excel-column field="car[0].car1">
 <vue-excel-column field="car[1].car2">

Thank you

cscan commented 6 months ago

You do not need to define the vue-excel-column tags, the component will create according to the JSON.

On Mon, 23 Oct 2023, 9:05 PM Samvel Gevorgyan, @.***> wrote:

Hi Could you please explain how can I use nested JSON as a column header field?

for example

{ ... car:[{car1: red},{car2: blue}] .... }

Thank you — Reply to this email directly, view it on GitHub , or unsubscribe . You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
kapilzrix commented 2 months ago

You do not need to define the vue-excel-column tags, the component will create according to the JSON. On Mon, 23 Oct 2023, 9:05 PM Samvel Gevorgyan, @.> wrote: Hi Could you please explain how can I use nested JSON as a column header field? for example { ... car:[{car1: red},{car2: blue}] .... } Thank you — Reply to this email directly, view it on GitHub <#36>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYSOF2DAML7UM7AO3DSLDDYAZTSTAVCNFSM6AAAAAA6MBMVNKVHI2DSMVQWIX3LMV43ASLTON2WKOZRHE2TOMJSGE3TOOI . You are receiving this because you are subscribed to this thread.Message ID: @.>

Hey cscan,

Not sure what you meant by your reply. Can you give a more specific example. Like I have the following jsondata:

[
        {
            "id": 3847,
            "primary_address_id": 4433,
            "secondary_address_id": null,
            "first_name": "Randall",
            "last_name": "Gorman",
            "email": "randallgorman@cox.net",
            "mobile": "(619)-743-7222",
            "office_number": "(858)-454-9011",
            "created_at": "2023-03-21T14:13:48.000000Z",
            "updated_at": "2023-04-14T13:57:54.000000Z",
            "is_deleted": false,
            "existing_lead": false,
            "is_featured": null,
            "sfid": "00Q4W00001h99NqUAI",
            "email2": "randall@ljcg.com",
            "email3": "",
            "phone3": "(858)-454-9007",
            "record_source": "Reonomy",
            "primary_adress": {
                "id": 4433,
                "address_line1": "4355 Ruffin Rd",
                "address_line2": null,
                "city": "San Diego",
                "state": "CA",
                "zipcode": null,
                "created_at": "2023-03-21T14:13:48.000000Z",
                "updated_at": "2023-03-21T14:13:48.000000Z"
            }
        }
]

And I want to show primary_adress.city under the city column, so I have adde this: <vue-excel-column field="primary_adress.city" label="City" type="string" width="150px" />

But it does not show anything. Kindly help.