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.

The events section on the bootstrap-table website is gone so I just tried, but no luck so far. I want to capture the onclickrow event. I have a table like this:

  <table id="id_main_dbgrid_1" name="main_dbgrid_1" data-toggle="table" data-url="./main.php?component=main_dbgrid_1" data-cache="true" data-height="100%" data-search="true" data-show-columns="true" data-show-refresh="true" data-pagination="true" data-side-pagination="server" data-page-list="[5, 10, 20, 50, 100, 250]" data-page-size="1" style="background-color:rgb(204,204,204);">
    <thead>
    <tr style="background-color:rgb(104,104,104);">
        <th data-field="naw_nr" data-searchable="true">nr</th>
        <th data-field="naw_naam" data-searchable="true">naam</th>
        <th data-field="naw_adres" data-searchable="true">adres</th>
        <th data-field="naw_woonplaats" data-searchable="true">woonplaats</th>
    </tr>
   </thead>
  </table>

I applied the following javascript:

    $("#id_main_dbgrid_1").onClickRow(function(row, $data) {
      var str='';
      procbutton(str+'&cmd=first');
    });         

This doesn’t get triggered. Other events in the same html like buttons onclick do work, so I must be doing something wrong. Besides that, the grid is working properly.
Can anybody point me what I’m doing wrong here?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
wenzhixincommented, Dec 10, 2015

@aducom, you use the event in a wrong way, the correct way is:

$("#id_main_dbgrid_1").bootstrapTable({
    onClickRow: function(row, $data) {
      var str='';
      procbutton(str+'&cmd=first');
    })
});

or:

$table.on('click-row.bs.table', function (e, row) {
    ...
});
0reactions
aducomcommented, Dec 10, 2015

Tnx for your correction and update docs. It’s a great component.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Introduction to events - Learn web development | MDN
Events are actions or occurrences that happen in the system you are programming, which the system tells you about so your code can...
Read more >
JavaScript Events - W3Schools
HTML events are "things" that happen to HTML elements. When JavaScript is used in HTML pages, JavaScript can "react" on these events.
Read more >
Handling Events in JavaScript
Learn how to perform event handling in JavaScript including HTML Event Handler attributes, DOM Level 0 Event Handlers, and DOM Level 2 Event...
Read more >
Events in C# - TutorialsTeacher
An event is a notification sent by an object to signal the occurrence of an action. Events in .NET follow the observer design...
Read more >
JavaScript - Events - Tutorialspoint
What is an Event ? ... JavaScript's interaction with HTML is handled through events that occur when the user or the browser manipulates...
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