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.

ajax within Detail Formatter function

See original GitHub issue

Instead of loading all the data for each detail view I’d like to pull it using ajax only when the row is shown. However, the following function does not show the data

function detailFormatter(index, row) {
    $.get('/ajax/details.php', { id:row.parentID }, function(data) {
        return data;
    });
}

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
wenzhixincommented, Jun 4, 2015

You can look at our example: http://issues.wenzhixin.net.cn/bootstrap-table/

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

For example:

$table.on('expand-row.bs.table', function (e, index, row, $detail) {
    $detail.html('Loading from ajax request...');
    $.get('LICENSE', function (res) {
        $detail.html(res.replace(/\n/g, '<br>'));
    });
});
0reactions
johnny2001commented, Mar 5, 2019

ehm you mean this?

you need “$detail” after “row” in the dateilFormatter

function detailFormatter(index, row, $detail) { $.ajax({ url: "/planung/subdata.php", method: 'GET', dataType: 'html' }).done(function(data){ $detail.html(data) }) }

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ajax call inside a formatter - SAP Community
Hi I have a table where for each column there is a formatter function invoked. For one of the columns, i need to...
Read more >
jquery - how to return a bootstrap table as a detailFormatter
Data can be loaded from the ajax and bind to the $detail. $table.on('expand-row.bs.table', function (e, index, row, $detail) { $detail.html('Loading from ...
Read more >
jQuery.ajax() | jQuery API Documentation
A pre-request callback function that can be used to modify the jqXHR (in jQuery 1.4.x, XMLHTTPRequest) object before it is sent. Use this...
Read more >
jQuery ajax() Method - TutorialsTeacher
This tutorial shows how to send ajax request using jQuery ajax() method. The jQuery ajax() method provides core functionality of Ajax in jQuery....
Read more >
Getting started - Developer guides - MDN Web Docs
It can send and receive information in various formats, including JSON, XML, HTML, and text files. AJAX's most appealing characteristic is ...
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