tui.grid icon indicating copy to clipboard operation
tui.grid copied to clipboard

Can't read a DataSource via api.

Open bsofte opened this issue 2 years ago • 0 comments

Summary I have no problem reading the local dataSource. Very simple. But no matter what I do, i can't read the api dataSource.

Screenshots This is the result of the local dataSource. No problem. 01

On the other hand, THIS is the result of api dataSource. No data displayed. Only a loading bar is shown endlessly. image

Version Grid version: Toast UI grid v4.0 Web framework: Django 3.2.8

Additional context Here is my code of the dataSource. The commented lines also are the codes I've tried. All failed.

....
        const dataSource = {
            //contentType: 'application/json',
            api: {
                readData: {
                    url: '/api/readData/,
                    //url: '/api_readData.html,
                    //url: '/api_readData.json,
                    //url: 'http://10.20.30.40/api/readData/',
                    //url: 'http://10.20.30.40/api_readData.html',
                    //url: 'http://10.20.30.40/api_readData.json',
                    method: 'GET',
                    //initParams: { param: 'param' }
                },
            },
            //initialRequest: true,
        }
....

And, here are my api codes. All failed as well. 1st try)

{
    'result': True,
    'data': {
        'contents':  [
            {'SeqNum': 1, 'name': 'XXX', 'job_title': 'manager', 'level': '4', 'start_date': '2019-01-01'},
            {'SeqNum': 2, 'name': 'YYY', 'job_title': 'manager', 'level': '3', 'start_date': '2020-01-01'},
	    ...
        ]
    },
}


2nd try)

json_val = {
    'result': True,
    'data': {
        'contents':  [
            {'SeqNum': 1, 'name': 'XXX', 'job_title': 'manager', 'level': '4', 'start_date': '2019-01-01'},
            {'SeqNum': 2, 'name': 'YYY', 'job_title': 'manager', 'level': '3', 'start_date': '2020-01-01'},
	    ...
        ]
    },
}

3rd try)

[
     {'SeqNum': 1, 'name': 'XXX', 'job_title': 'manager', 'level': '4', 'start_date': '2019-01-01'},
     {'SeqNum': 2, 'name': 'YYY', 'job_title': 'manager', 'level': '3', 'start_date': '2020-01-01'},
	  ...
]

I've tried a lot, I've searched so many references about the Toast UI grid. But I can't seem to make it so far. Any comments would be helpful.

bsofte avatar Jul 10 '22 10:07 bsofte