question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Loading Ajax data with nested Arrays

See original GitHub issue

It seems like loading data from Ajax view will only work if the data is in a single array such as var data = [ { "id": 0, "name": "Item 0", "price": "$0" }, { "id": 1, "name": "Item 1", "price": "$1" }, { "id": 2, "name": "Item 2", "price": "$2" } ];

Is it possible if var data = [ { "id": 0, "name": "Item 0", "price": "$0", "tags": [1,2,3,4] }, { "id": 1, "name": "Item 1", "price": "$1", "tags": [1,2,3,4] }, { "id": 2, "name": "Item 2", "price": "$2", "tags": [1,2,3,4] } ];

and as a result shows the array values as part of a rowspan within the id.

screen shot 2016-06-09 at 3 18 05 pm

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
dabroscommented, Jun 16, 2016

@Physium - go to example, click ‘view source on github’ in top right, ctrl+f “responseHandler”

There are only 2 bits of code related to it, and there is no further way to describe it then has already been said, just look at it and use it

Plenty other issues mention it too: https://github.com/wenzhixin/bootstrap-table/issues?utf8=✓&q=is%3Aissue+responseHandler

https://github.com/wenzhixin/bootstrap-table-examples/blob/master/welcome.html

data-response-handler="responseHandler"


    function responseHandler(res) {
        $.each(res.rows, function (i, row) {
            row.state = $.inArray(row.id, selections) !== -1;
        });
        return res;
    }

0reactions
Physiumcommented, Jun 22, 2016

@dabros thanks for the advice. I’ll close this issue!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Ajax to loop through nested Array to retrieve data
Using Ajax to loop through nested Array to retrieve data · 1) You don't need a second $(document).ready function. · 2) You don't...
Read more >
How to load data from nested arrays in DataTables
In this article, we will learn to read information for each employee from a nested array using the DataTables plugin. Approach: The DataTables ......
Read more >
Nested object data (arrays) - DataTables example
The information read from an Ajax data source can be arbitrarily complex, but still be displayed by DataTables through the columns.data option, ...
Read more >
Using to jQuery to access JSON nested array starting with dates
I'm attempting to build a ajax call from some json data jQuery.ajax({ type: "GET", url: "websiteurl.com", success: function(data) {
Read more >
Ajax load more for nested repeaters. · Issue #1 - GitHub
In the AJAX request, pass the field key as well as changing the value of offset to the array element for that key....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found